{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "# <center> P300 Classification </center>\n",
    "\n",
    "\n",
    "\n",
    "<center> 王中寅 陆思翔 周煊 胡晗 张睿 李春洋 </center>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "# <center>Preprocess </center>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [],
   "source": [
    "load Subject_Train.mat;\n",
    "window=240; % window after stimulus (1s)\n",
    "\n",
    "responses_train = zeros(12, 15, 240, 64, 85);\n",
    "is_stimulate = zeros(12, 15, 85);\n",
    "\n",
    "% convert to double precision\n",
    "Signal=double(Signal);\n",
    "Flashing=double(Flashing);\n",
    "StimulusCode=double(StimulusCode);\n",
    "StimulusType=double(StimulusType);\n",
    "\n",
    "% for each character epoch\n",
    "for epoch=1:size(Signal,1)\n",
    "    % get reponse samples at start of each Flash\n",
    "    rowcolcnt=ones(1,12);\n",
    "    block = 1;\n",
    "    for n=2:size(Signal,2) \n",
    "        if Flashing(epoch,n)==0 && Flashing(epoch,n-1)==1\n",
    "            rowcol=StimulusCode(epoch,n-1);\n",
    "            responses_train(rowcol,rowcolcnt(rowcol),:,:,epoch)=Signal(epoch,n-24:n+window-25,:);\n",
    "            rowcolcnt(rowcol)=rowcolcnt(rowcol)+1;\n",
    "            if StimulusType(epoch, n-1) == 1\n",
    "                is_stimulate(rowcol, block, epoch) = 1;               \n",
    "            end\n",
    "        end\n",
    "        if mod(n, 504) == 0\n",
    "            block = block + 1;\n",
    "        end\n",
    "    end\n",
    "end\n",
    "\n",
    "\n",
    "responses_train = reshape(mean(responses_train, 2), 12, 240, 64, 85);\n",
    "is_stimulate_train = uint8(reshape(mean(is_stimulate, 2), 12, 85));"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [],
   "source": [
    "clear all;  \n",
    "clc;\n",
    "temp=zeros(12,85,64,240);\n",
    "\n",
    "load ('data_train.mat');\n",
    "data = [];\n",
    "label = [];\n",
    "\n",
    "temp=permute(responses_train,[2,1,3,4]);\n",
    "data_temp1=squeeze(temp(:,:,3,:));\n",
    "data_temp2=squeeze(temp(:,:,5,:));\n",
    "data_temp3=squeeze(temp(:,:,9,:));\n",
    "data_temp4=squeeze(temp(:,:,11,:));\n",
    "data_temp5=squeeze(temp(:,:,13,:));\n",
    "data_temp6=squeeze(temp(:,:,22,:));\n",
    "data_temp7=squeeze(temp(:,:,24,:));\n",
    "data_temp8=squeeze(temp(:,:,34,:));\n",
    "data_temp9=squeeze(temp(:,:,51,:));\n",
    "data_temp10=squeeze(temp(:,:,56,:));\n",
    "data_temp11=squeeze(temp(:,:,60,:));\n",
    "\n",
    "responses_train=[data_temp1;data_temp2;data_temp3;data_temp4;data_temp5;data_temp6;data_temp7;data_temp8;data_temp9;data_temp10;data_temp11];\n",
    "\n",
    "\n",
    "responses_train=permute(responses_train,[2,3,1]);\n",
    "responses_train=reshape(responses_train,12,85,2640);\n",
    "for i=1:12\n",
    "    for j=1:85    \n",
    "        data = [data; responses_train(i, j,:)];\n",
    "        label = [label; is_stimulate_train(i, j)];\n",
    "    end\n",
    "end\n",
    "\n",
    "data = reshape(data, 1020, 2640);\n",
    "\n",
    "Model= fitcsvm(data,label);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [],
   "source": [
    "\n",
    "load ('data_test.mat');\n",
    "test_data=[];\n",
    "\n",
    "% responses_predict=permute(responses_test,[1,4,3,2]);\n",
    "% responses_predict=reshape(responses_predict,12,100,15360);\n",
    "temp=permute(responses_test,[2,1,3,4]);\n",
    "data_temp1=squeeze(temp(:,:,3,:));\n",
    "data_temp2=squeeze(temp(:,:,5,:));\n",
    "data_temp3=squeeze(temp(:,:,9,:));\n",
    "data_temp4=squeeze(temp(:,:,11,:));\n",
    "data_temp5=squeeze(temp(:,:,13,:));\n",
    "data_temp6=squeeze(temp(:,:,22,:));\n",
    "data_temp7=squeeze(temp(:,:,24,:));\n",
    "data_temp8=squeeze(temp(:,:,34,:));\n",
    "data_temp9=squeeze(temp(:,:,51,:));\n",
    "data_temp10=squeeze(temp(:,:,56,:));\n",
    "data_temp11=squeeze(temp(:,:,60,:));\n",
    "\n",
    "responses_test=[data_temp1;data_temp2;data_temp3;data_temp4;data_temp5;data_temp6;data_temp7;data_temp8;data_temp9;data_temp10;data_temp11];\n",
    "\n",
    "\n",
    "responses_test=permute(responses_test,[2,3,1]);\n",
    "responses_test=reshape(responses_test,12,100,2640);\n",
    "\n",
    "\n",
    "for m=1:12\n",
    "    for n=1:100    \n",
    "       test_data = [test_data; responses_test(m, n,:)];   \n",
    "    end\n",
    "end\n",
    "\n",
    "test_data = reshape(test_data, 1200, 2640);\n",
    "load Model.mat\n",
    "[label,score] = predict(Model_B,test_data);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "![](./trainA.png)\n",
    "![](./testA.png)\n",
    "![](./trainB.png)\n",
    "![](./testB.png)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RNN(\n",
      "  (rnn): LSTM(240, 64, batch_first=True)\n",
      "  (out): Linear(in_features=64, out_features=2, bias=True)\n",
      ")\n"
     ]
    }
   ],
   "source": [
    "from Model import RNN\n",
    "\n",
    "model = RNN()\n",
    "print(model)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch: 0 Loss: 0.7089760899543762,  Acc: 0.5032679738562091\n",
      "Valid Epoch: 0 Loss: 0.7166054844856262,  Acc: 0.4647058823529412\n",
      "Epoch: 1 Loss: 0.7012990713119507,  Acc: 0.5222222222222223\n",
      "Valid Epoch: 1 Loss: 0.7104247808456421,  Acc: 0.47058823529411764\n",
      "Epoch: 2 Loss: 0.6928709745407104,  Acc: 0.5490196078431372\n",
      "Valid Epoch: 2 Loss: 0.7042758464813232,  Acc: 0.49411764705882355\n",
      "Epoch: 3 Loss: 0.6855147480964661,  Acc: 0.5640522875816993\n",
      "Valid Epoch: 3 Loss: 0.6983047723770142,  Acc: 0.5058823529411764\n",
      "Epoch: 4 Loss: 0.6785611510276794,  Acc: 0.5771241830065358\n",
      "Valid Epoch: 4 Loss: 0.692664384841919,  Acc: 0.5176470588235293\n",
      "Epoch: 5 Loss: 0.6716911792755127,  Acc: 0.588235294117647\n",
      "Valid Epoch: 5 Loss: 0.6872011423110962,  Acc: 0.5352941176470588\n",
      "Epoch: 6 Loss: 0.6653432846069336,  Acc: 0.6013071895424835\n",
      "Valid Epoch: 6 Loss: 0.6820334196090698,  Acc: 0.5588235294117647\n",
      "Epoch: 7 Loss: 0.6593852043151855,  Acc: 0.6130718954248366\n",
      "Valid Epoch: 7 Loss: 0.6767023205757141,  Acc: 0.5529411764705883\n",
      "Epoch: 8 Loss: 0.653433084487915,  Acc: 0.6267973856209149\n",
      "Valid Epoch: 8 Loss: 0.6716564893722534,  Acc: 0.5529411764705883\n",
      "Epoch: 9 Loss: 0.6479261517524719,  Acc: 0.637908496732026\n",
      "Valid Epoch: 9 Loss: 0.6666896343231201,  Acc: 0.5647058823529412\n",
      "Epoch: 10 Loss: 0.6423825025558472,  Acc: 0.6503267973856208\n",
      "Valid Epoch: 10 Loss: 0.6621373891830444,  Acc: 0.6\n",
      "Epoch: 11 Loss: 0.6370464563369751,  Acc: 0.6660130718954247\n",
      "Valid Epoch: 11 Loss: 0.6573998928070068,  Acc: 0.611764705882353\n",
      "Epoch: 12 Loss: 0.6317986845970154,  Acc: 0.6797385620915031\n",
      "Valid Epoch: 12 Loss: 0.653087317943573,  Acc: 0.6176470588235294\n",
      "Epoch: 13 Loss: 0.6267863512039185,  Acc: 0.6843137254901959\n",
      "Valid Epoch: 13 Loss: 0.6486306190490723,  Acc: 0.6235294117647059\n",
      "Epoch: 14 Loss: 0.6215230226516724,  Acc: 0.6947712418300651\n",
      "Valid Epoch: 14 Loss: 0.6442347764968872,  Acc: 0.6411764705882352\n",
      "Epoch: 15 Loss: 0.6162302494049072,  Acc: 0.7013071895424836\n",
      "Valid Epoch: 15 Loss: 0.6394801139831543,  Acc: 0.6470588235294118\n",
      "Epoch: 16 Loss: 0.6106318831443787,  Acc: 0.7124183006535949\n",
      "Valid Epoch: 16 Loss: 0.634697437286377,  Acc: 0.6647058823529413\n",
      "Epoch: 17 Loss: 0.6053292155265808,  Acc: 0.7209150326797388\n",
      "Valid Epoch: 17 Loss: 0.6302497386932373,  Acc: 0.6588235294117647\n",
      "Epoch: 18 Loss: 0.6001213788986206,  Acc: 0.7248366013071894\n",
      "Valid Epoch: 18 Loss: 0.6256115436553955,  Acc: 0.6647058823529411\n",
      "Epoch: 19 Loss: 0.5950146913528442,  Acc: 0.7352941176470588\n",
      "Valid Epoch: 19 Loss: 0.6208897829055786,  Acc: 0.6705882352941177\n",
      "Epoch: 20 Loss: 0.5896852612495422,  Acc: 0.74640522875817\n",
      "Valid Epoch: 20 Loss: 0.616981029510498,  Acc: 0.6823529411764706\n",
      "Epoch: 21 Loss: 0.5845158100128174,  Acc: 0.7529411764705882\n",
      "Valid Epoch: 21 Loss: 0.6115908622741699,  Acc: 0.6882352941176471\n",
      "Epoch: 22 Loss: 0.5792527198791504,  Acc: 0.7555555555555555\n",
      "Valid Epoch: 22 Loss: 0.6070334911346436,  Acc: 0.6941176470588235\n",
      "Epoch: 23 Loss: 0.5740340352058411,  Acc: 0.7588235294117648\n",
      "Valid Epoch: 23 Loss: 0.6026674509048462,  Acc: 0.7\n",
      "Epoch: 24 Loss: 0.5688512921333313,  Acc: 0.7679738562091503\n",
      "Valid Epoch: 24 Loss: 0.5979788303375244,  Acc: 0.7\n",
      "Epoch: 25 Loss: 0.5636425018310547,  Acc: 0.7692810457516341\n",
      "Valid Epoch: 25 Loss: 0.5938364267349243,  Acc: 0.7058823529411764\n",
      "Epoch: 26 Loss: 0.5584261417388916,  Acc: 0.7764705882352944\n",
      "Valid Epoch: 26 Loss: 0.589561939239502,  Acc: 0.7117647058823529\n",
      "Epoch: 27 Loss: 0.5530900359153748,  Acc: 0.7836601307189544\n",
      "Valid Epoch: 27 Loss: 0.5851128697395325,  Acc: 0.7411764705882353\n",
      "Epoch: 28 Loss: 0.5479223728179932,  Acc: 0.7901960784313729\n",
      "Valid Epoch: 28 Loss: 0.5811076164245605,  Acc: 0.7470588235294118\n",
      "Epoch: 29 Loss: 0.5427579283714294,  Acc: 0.8000000000000002\n",
      "Valid Epoch: 29 Loss: 0.5770890712738037,  Acc: 0.7470588235294118\n",
      "Epoch: 30 Loss: 0.5373926162719727,  Acc: 0.8071895424836604\n",
      "Valid Epoch: 30 Loss: 0.5730353593826294,  Acc: 0.7529411764705882\n",
      "Epoch: 31 Loss: 0.5320776700973511,  Acc: 0.8176470588235296\n",
      "Valid Epoch: 31 Loss: 0.569463849067688,  Acc: 0.7647058823529411\n",
      "Epoch: 32 Loss: 0.5265684127807617,  Acc: 0.8176470588235296\n",
      "Valid Epoch: 32 Loss: 0.5655522346496582,  Acc: 0.7588235294117647\n",
      "Epoch: 33 Loss: 0.5208932161331177,  Acc: 0.8294117647058825\n",
      "Valid Epoch: 33 Loss: 0.5620014667510986,  Acc: 0.7647058823529411\n",
      "Epoch: 34 Loss: 0.5153366327285767,  Acc: 0.8307189542483662\n",
      "Valid Epoch: 34 Loss: 0.557792067527771,  Acc: 0.7705882352941176\n",
      "Epoch: 35 Loss: 0.5101721286773682,  Acc: 0.8307189542483662\n",
      "Valid Epoch: 35 Loss: 0.5539256930351257,  Acc: 0.7647058823529411\n",
      "Epoch: 36 Loss: 0.5050056576728821,  Acc: 0.8326797385620917\n",
      "Valid Epoch: 36 Loss: 0.5500876903533936,  Acc: 0.7647058823529411\n",
      "Epoch: 37 Loss: 0.49976593255996704,  Acc: 0.8372549019607844\n",
      "Valid Epoch: 37 Loss: 0.5460701584815979,  Acc: 0.7705882352941176\n",
      "Epoch: 38 Loss: 0.4945639967918396,  Acc: 0.8379084967320264\n",
      "Valid Epoch: 38 Loss: 0.5423228740692139,  Acc: 0.7647058823529411\n",
      "Epoch: 39 Loss: 0.4894251227378845,  Acc: 0.8392156862745099\n",
      "Valid Epoch: 39 Loss: 0.5383279323577881,  Acc: 0.7647058823529411\n",
      "Epoch: 40 Loss: 0.48437753319740295,  Acc: 0.8418300653594774\n",
      "Valid Epoch: 40 Loss: 0.5346283316612244,  Acc: 0.7647058823529411\n",
      "Epoch: 41 Loss: 0.4793799817562103,  Acc: 0.8418300653594772\n",
      "Valid Epoch: 41 Loss: 0.5307643413543701,  Acc: 0.7647058823529411\n",
      "Epoch: 42 Loss: 0.47438108921051025,  Acc: 0.8444444444444447\n",
      "Valid Epoch: 42 Loss: 0.5269626975059509,  Acc: 0.7470588235294118\n",
      "Epoch: 43 Loss: 0.46923601627349854,  Acc: 0.8444444444444446\n",
      "Valid Epoch: 43 Loss: 0.5229293704032898,  Acc: 0.7470588235294118\n",
      "Epoch: 44 Loss: 0.46418100595474243,  Acc: 0.8477124183006539\n",
      "Valid Epoch: 44 Loss: 0.5191919803619385,  Acc: 0.7470588235294118\n",
      "Epoch: 45 Loss: 0.459071546792984,  Acc: 0.8509803921568629\n",
      "Valid Epoch: 45 Loss: 0.515355110168457,  Acc: 0.7529411764705882\n",
      "Epoch: 46 Loss: 0.4539441168308258,  Acc: 0.8522875816993466\n",
      "Valid Epoch: 46 Loss: 0.5115278959274292,  Acc: 0.7529411764705882\n",
      "Epoch: 47 Loss: 0.44870975613594055,  Acc: 0.854901960784314\n",
      "Valid Epoch: 47 Loss: 0.5078547596931458,  Acc: 0.7588235294117647\n",
      "Epoch: 48 Loss: 0.4434564411640167,  Acc: 0.8555555555555556\n",
      "Valid Epoch: 48 Loss: 0.5042502880096436,  Acc: 0.7588235294117647\n",
      "Epoch: 49 Loss: 0.43816807866096497,  Acc: 0.8575163398692812\n",
      "Valid Epoch: 49 Loss: 0.5004416108131409,  Acc: 0.7647058823529411\n",
      "Epoch: 50 Loss: 0.432987242937088,  Acc: 0.858169934640523\n",
      "Valid Epoch: 50 Loss: 0.4970642328262329,  Acc: 0.7647058823529411\n",
      "Epoch: 51 Loss: 0.4278561472892761,  Acc: 0.8594771241830067\n",
      "Valid Epoch: 51 Loss: 0.49350401759147644,  Acc: 0.7647058823529411\n",
      "Epoch: 52 Loss: 0.4226974546909332,  Acc: 0.8607843137254904\n",
      "Valid Epoch: 52 Loss: 0.48963528871536255,  Acc: 0.7647058823529411\n",
      "Epoch: 53 Loss: 0.41759344935417175,  Acc: 0.8679738562091506\n",
      "Valid Epoch: 53 Loss: 0.4863813817501068,  Acc: 0.7705882352941176\n",
      "Epoch: 54 Loss: 0.41246747970581055,  Acc: 0.869934640522876\n",
      "Valid Epoch: 54 Loss: 0.4832446575164795,  Acc: 0.7705882352941176\n",
      "Epoch: 55 Loss: 0.40744125843048096,  Acc: 0.8738562091503269\n",
      "Valid Epoch: 55 Loss: 0.4798862040042877,  Acc: 0.776470588235294\n",
      "Epoch: 56 Loss: 0.40230080485343933,  Acc: 0.8777777777777779\n",
      "Valid Epoch: 56 Loss: 0.4761534035205841,  Acc: 0.788235294117647\n",
      "Epoch: 57 Loss: 0.39683467149734497,  Acc: 0.8797385620915036\n",
      "Valid Epoch: 57 Loss: 0.47204720973968506,  Acc: 0.7823529411764706\n",
      "Epoch: 58 Loss: 0.3914102613925934,  Acc: 0.8797385620915034\n",
      "Valid Epoch: 58 Loss: 0.468422532081604,  Acc: 0.7941176470588236\n",
      "Epoch: 59 Loss: 0.3859963119029999,  Acc: 0.8869281045751636\n",
      "Valid Epoch: 59 Loss: 0.4646420478820801,  Acc: 0.8\n",
      "Epoch: 60 Loss: 0.3808630108833313,  Acc: 0.8901960784313727\n",
      "Valid Epoch: 60 Loss: 0.4610027074813843,  Acc: 0.8\n",
      "Epoch: 61 Loss: 0.37593767046928406,  Acc: 0.8921568627450982\n",
      "Valid Epoch: 61 Loss: 0.4572068154811859,  Acc: 0.8\n",
      "Epoch: 62 Loss: 0.3710469901561737,  Acc: 0.8934640522875819\n",
      "Valid Epoch: 62 Loss: 0.4535492956638336,  Acc: 0.8\n",
      "Epoch: 63 Loss: 0.365994393825531,  Acc: 0.8973856209150328\n",
      "Valid Epoch: 63 Loss: 0.4505159258842468,  Acc: 0.8\n",
      "Epoch: 64 Loss: 0.36127233505249023,  Acc: 0.9045751633986929\n",
      "Valid Epoch: 64 Loss: 0.4471539556980133,  Acc: 0.8058823529411765\n",
      "Epoch: 65 Loss: 0.35657376050949097,  Acc: 0.9065359477124184\n",
      "Valid Epoch: 65 Loss: 0.4432436227798462,  Acc: 0.8058823529411765\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch: 66 Loss: 0.35195842385292053,  Acc: 0.9078431372549021\n",
      "Valid Epoch: 66 Loss: 0.4397846460342407,  Acc: 0.8058823529411765\n",
      "Epoch: 67 Loss: 0.3475070893764496,  Acc: 0.911764705882353\n",
      "Valid Epoch: 67 Loss: 0.4368153214454651,  Acc: 0.8058823529411765\n",
      "Epoch: 68 Loss: 0.3429006338119507,  Acc: 0.9150326797385622\n",
      "Valid Epoch: 68 Loss: 0.4325263500213623,  Acc: 0.8058823529411765\n",
      "Epoch: 69 Loss: 0.33835458755493164,  Acc: 0.9150326797385622\n",
      "Valid Epoch: 69 Loss: 0.42916321754455566,  Acc: 0.8117647058823529\n",
      "Epoch: 70 Loss: 0.3339473605155945,  Acc: 0.9169934640522877\n",
      "Valid Epoch: 70 Loss: 0.42574161291122437,  Acc: 0.8117647058823529\n",
      "Epoch: 71 Loss: 0.32970142364501953,  Acc: 0.9209150326797386\n",
      "Valid Epoch: 71 Loss: 0.422390878200531,  Acc: 0.8176470588235294\n",
      "Epoch: 72 Loss: 0.3253413438796997,  Acc: 0.9254901960784314\n",
      "Valid Epoch: 72 Loss: 0.41866880655288696,  Acc: 0.8235294117647058\n",
      "Epoch: 73 Loss: 0.32108697295188904,  Acc: 0.9287581699346406\n",
      "Valid Epoch: 73 Loss: 0.41540175676345825,  Acc: 0.8235294117647058\n",
      "Epoch: 74 Loss: 0.3168720304965973,  Acc: 0.9339869281045752\n",
      "Valid Epoch: 74 Loss: 0.4120151698589325,  Acc: 0.8352941176470587\n",
      "Epoch: 75 Loss: 0.31275811791419983,  Acc: 0.9352941176470588\n",
      "Valid Epoch: 75 Loss: 0.4083021283149719,  Acc: 0.8352941176470587\n",
      "Epoch: 76 Loss: 0.3086436688899994,  Acc: 0.9352941176470588\n",
      "Valid Epoch: 76 Loss: 0.4050667881965637,  Acc: 0.8352941176470587\n",
      "Epoch: 77 Loss: 0.30457618832588196,  Acc: 0.938562091503268\n",
      "Valid Epoch: 77 Loss: 0.4016847014427185,  Acc: 0.8352941176470587\n",
      "Epoch: 78 Loss: 0.30094534158706665,  Acc: 0.9398692810457516\n",
      "Valid Epoch: 78 Loss: 0.39854422211647034,  Acc: 0.8352941176470587\n",
      "Epoch: 79 Loss: 0.29692167043685913,  Acc: 0.9411764705882353\n",
      "Valid Epoch: 79 Loss: 0.39546558260917664,  Acc: 0.8352941176470587\n",
      "Epoch: 80 Loss: 0.29289013147354126,  Acc: 0.9424836601307189\n",
      "Valid Epoch: 80 Loss: 0.39214327931404114,  Acc: 0.8352941176470587\n",
      "Epoch: 81 Loss: 0.2889711260795593,  Acc: 0.9424836601307189\n",
      "Valid Epoch: 81 Loss: 0.38886135816574097,  Acc: 0.8411764705882352\n",
      "Epoch: 82 Loss: 0.2851985692977905,  Acc: 0.9477124183006536\n",
      "Valid Epoch: 82 Loss: 0.38593894243240356,  Acc: 0.8411764705882352\n",
      "Epoch: 83 Loss: 0.28143516182899475,  Acc: 0.9490196078431372\n",
      "Valid Epoch: 83 Loss: 0.3830859661102295,  Acc: 0.8411764705882352\n",
      "Epoch: 84 Loss: 0.2777150869369507,  Acc: 0.9503267973856209\n",
      "Valid Epoch: 84 Loss: 0.37988919019699097,  Acc: 0.8470588235294118\n",
      "Epoch: 85 Loss: 0.27407747507095337,  Acc: 0.9503267973856209\n",
      "Valid Epoch: 85 Loss: 0.37689149379730225,  Acc: 0.8529411764705882\n",
      "Epoch: 86 Loss: 0.2704687714576721,  Acc: 0.9503267973856209\n",
      "Valid Epoch: 86 Loss: 0.3739393353462219,  Acc: 0.8529411764705882\n",
      "Epoch: 87 Loss: 0.26698875427246094,  Acc: 0.9503267973856209\n",
      "Valid Epoch: 87 Loss: 0.37080812454223633,  Acc: 0.8529411764705882\n",
      "Epoch: 88 Loss: 0.26360753178596497,  Acc: 0.9503267973856209\n",
      "Valid Epoch: 88 Loss: 0.36814868450164795,  Acc: 0.8529411764705882\n",
      "Epoch: 89 Loss: 0.26015180349349976,  Acc: 0.9516339869281045\n",
      "Valid Epoch: 89 Loss: 0.36530938744544983,  Acc: 0.8529411764705882\n",
      "Epoch: 90 Loss: 0.25680795311927795,  Acc: 0.9509803921568627\n",
      "Valid Epoch: 90 Loss: 0.36291414499282837,  Acc: 0.8470588235294118\n",
      "Epoch: 91 Loss: 0.2535172700881958,  Acc: 0.9522875816993464\n",
      "Valid Epoch: 91 Loss: 0.35972368717193604,  Acc: 0.8529411764705883\n",
      "Epoch: 92 Loss: 0.2501625120639801,  Acc: 0.9549019607843137\n",
      "Valid Epoch: 92 Loss: 0.3569788336753845,  Acc: 0.8647058823529412\n",
      "Epoch: 93 Loss: 0.24693451821804047,  Acc: 0.9549019607843139\n",
      "Valid Epoch: 93 Loss: 0.3544467091560364,  Acc: 0.8529411764705883\n",
      "Epoch: 94 Loss: 0.2436731904745102,  Acc: 0.9555555555555557\n",
      "Valid Epoch: 94 Loss: 0.3518763780593872,  Acc: 0.8588235294117648\n",
      "Epoch: 95 Loss: 0.24046604335308075,  Acc: 0.9562091503267973\n",
      "Valid Epoch: 95 Loss: 0.3483569622039795,  Acc: 0.8588235294117648\n",
      "Epoch: 96 Loss: 0.23722298443317413,  Acc: 0.9562091503267973\n",
      "Valid Epoch: 96 Loss: 0.34614574909210205,  Acc: 0.8588235294117648\n",
      "Epoch: 97 Loss: 0.2340305894613266,  Acc: 0.9575163398692812\n",
      "Valid Epoch: 97 Loss: 0.34331828355789185,  Acc: 0.8647058823529412\n",
      "Epoch: 98 Loss: 0.2309206873178482,  Acc: 0.9607843137254901\n",
      "Valid Epoch: 98 Loss: 0.34082287549972534,  Acc: 0.8647058823529412\n",
      "Epoch: 99 Loss: 0.22783268988132477,  Acc: 0.9607843137254903\n",
      "Valid Epoch: 99 Loss: 0.33794915676116943,  Acc: 0.8647058823529412\n",
      "Epoch: 100 Loss: 0.22491148114204407,  Acc: 0.962091503267974\n",
      "Valid Epoch: 100 Loss: 0.3353959918022156,  Acc: 0.8647058823529412\n",
      "Epoch: 101 Loss: 0.22196194529533386,  Acc: 0.9620915032679738\n",
      "Valid Epoch: 101 Loss: 0.33226507902145386,  Acc: 0.8647058823529412\n",
      "Epoch: 102 Loss: 0.21912752091884613,  Acc: 0.9627450980392156\n",
      "Valid Epoch: 102 Loss: 0.33038079738616943,  Acc: 0.8705882352941177\n",
      "Epoch: 103 Loss: 0.2162550389766693,  Acc: 0.9647058823529413\n",
      "Valid Epoch: 103 Loss: 0.3278123736381531,  Acc: 0.8705882352941177\n",
      "Epoch: 104 Loss: 0.21348118782043457,  Acc: 0.9647058823529413\n",
      "Valid Epoch: 104 Loss: 0.32506874203681946,  Acc: 0.8705882352941177\n",
      "Epoch: 105 Loss: 0.21077761054039001,  Acc: 0.9653594771241831\n",
      "Valid Epoch: 105 Loss: 0.32277464866638184,  Acc: 0.8705882352941177\n",
      "Epoch: 106 Loss: 0.20799461007118225,  Acc: 0.9653594771241829\n",
      "Valid Epoch: 106 Loss: 0.32034584879875183,  Acc: 0.8764705882352941\n",
      "Epoch: 107 Loss: 0.20536229014396667,  Acc: 0.9660130718954247\n",
      "Valid Epoch: 107 Loss: 0.3178979754447937,  Acc: 0.8764705882352941\n",
      "Epoch: 108 Loss: 0.20274558663368225,  Acc: 0.9673202614379084\n",
      "Valid Epoch: 108 Loss: 0.31526488065719604,  Acc: 0.8941176470588235\n",
      "Epoch: 109 Loss: 0.20019671320915222,  Acc: 0.9679738562091504\n",
      "Valid Epoch: 109 Loss: 0.3130910396575928,  Acc: 0.8941176470588235\n",
      "Epoch: 110 Loss: 0.19758093357086182,  Acc: 0.9679738562091504\n",
      "Valid Epoch: 110 Loss: 0.3108368515968323,  Acc: 0.8941176470588235\n",
      "Epoch: 111 Loss: 0.19513078033924103,  Acc: 0.9679738562091504\n",
      "Valid Epoch: 111 Loss: 0.3083825409412384,  Acc: 0.8941176470588235\n",
      "Epoch: 112 Loss: 0.1926371157169342,  Acc: 0.9699346405228757\n",
      "Valid Epoch: 112 Loss: 0.30590003728866577,  Acc: 0.8941176470588235\n",
      "Epoch: 113 Loss: 0.19021573662757874,  Acc: 0.9718954248366012\n",
      "Valid Epoch: 113 Loss: 0.30357569456100464,  Acc: 0.8941176470588235\n",
      "Epoch: 114 Loss: 0.18771691620349884,  Acc: 0.9725490196078432\n",
      "Valid Epoch: 114 Loss: 0.3016420900821686,  Acc: 0.8941176470588235\n",
      "Epoch: 115 Loss: 0.18537139892578125,  Acc: 0.9725490196078432\n",
      "Valid Epoch: 115 Loss: 0.299365371465683,  Acc: 0.8941176470588235\n",
      "Epoch: 116 Loss: 0.18304376304149628,  Acc: 0.9725490196078432\n",
      "Valid Epoch: 116 Loss: 0.2970006465911865,  Acc: 0.9\n",
      "Epoch: 117 Loss: 0.1806964874267578,  Acc: 0.9751633986928105\n",
      "Valid Epoch: 117 Loss: 0.29485082626342773,  Acc: 0.9\n",
      "Epoch: 118 Loss: 0.17825695872306824,  Acc: 0.9758169934640524\n",
      "Valid Epoch: 118 Loss: 0.29262205958366394,  Acc: 0.9\n",
      "Epoch: 119 Loss: 0.1760328710079193,  Acc: 0.9758169934640524\n",
      "Valid Epoch: 119 Loss: 0.290768027305603,  Acc: 0.9\n",
      "Epoch: 120 Loss: 0.17377908527851105,  Acc: 0.9758169934640524\n",
      "Valid Epoch: 120 Loss: 0.28840839862823486,  Acc: 0.9\n",
      "Epoch: 121 Loss: 0.17161329090595245,  Acc: 0.976470588235294\n",
      "Valid Epoch: 121 Loss: 0.28644508123397827,  Acc: 0.9\n",
      "Epoch: 122 Loss: 0.16956257820129395,  Acc: 0.977124183006536\n",
      "Valid Epoch: 122 Loss: 0.28440725803375244,  Acc: 0.9058823529411765\n",
      "Epoch: 123 Loss: 0.16732878983020782,  Acc: 0.9790849673202615\n",
      "Valid Epoch: 123 Loss: 0.282285213470459,  Acc: 0.9058823529411765\n",
      "Epoch: 124 Loss: 0.16529925167560577,  Acc: 0.9790849673202613\n",
      "Valid Epoch: 124 Loss: 0.2804029583930969,  Acc: 0.9058823529411765\n",
      "Epoch: 125 Loss: 0.16317494213581085,  Acc: 0.9816993464052288\n",
      "Valid Epoch: 125 Loss: 0.27854976058006287,  Acc: 0.9058823529411765\n",
      "Epoch: 126 Loss: 0.1610988825559616,  Acc: 0.9816993464052288\n",
      "Valid Epoch: 126 Loss: 0.27685898542404175,  Acc: 0.9117647058823529\n",
      "Epoch: 127 Loss: 0.1591629534959793,  Acc: 0.9816993464052288\n",
      "Valid Epoch: 127 Loss: 0.274988055229187,  Acc: 0.9058823529411765\n",
      "Epoch: 128 Loss: 0.1571396440267563,  Acc: 0.9816993464052288\n",
      "Valid Epoch: 128 Loss: 0.2728791832923889,  Acc: 0.9176470588235295\n",
      "Epoch: 129 Loss: 0.1552480012178421,  Acc: 0.9823529411764707\n",
      "Valid Epoch: 129 Loss: 0.2711498737335205,  Acc: 0.9176470588235295\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch: 130 Loss: 0.15332944691181183,  Acc: 0.9823529411764707\n",
      "Valid Epoch: 130 Loss: 0.2692352533340454,  Acc: 0.9176470588235295\n",
      "Epoch: 131 Loss: 0.15115177631378174,  Acc: 0.9830065359477125\n",
      "Valid Epoch: 131 Loss: 0.26750895380973816,  Acc: 0.9176470588235295\n",
      "Epoch: 132 Loss: 0.1492900401353836,  Acc: 0.9836601307189543\n",
      "Valid Epoch: 132 Loss: 0.2656724154949188,  Acc: 0.9176470588235295\n",
      "Epoch: 133 Loss: 0.14733265340328217,  Acc: 0.9862745098039216\n",
      "Valid Epoch: 133 Loss: 0.26380762457847595,  Acc: 0.9176470588235295\n",
      "Epoch: 134 Loss: 0.14554302394390106,  Acc: 0.9862745098039216\n",
      "Valid Epoch: 134 Loss: 0.2621820569038391,  Acc: 0.9176470588235295\n",
      "Epoch: 135 Loss: 0.14375221729278564,  Acc: 0.9862745098039216\n",
      "Valid Epoch: 135 Loss: 0.2601774036884308,  Acc: 0.9176470588235295\n",
      "Epoch: 136 Loss: 0.1420462280511856,  Acc: 0.9869281045751634\n",
      "Valid Epoch: 136 Loss: 0.2582733929157257,  Acc: 0.9176470588235295\n",
      "Epoch: 137 Loss: 0.1402720957994461,  Acc: 0.9869281045751634\n",
      "Valid Epoch: 137 Loss: 0.25650814175605774,  Acc: 0.9176470588235295\n",
      "Epoch: 138 Loss: 0.13857656717300415,  Acc: 0.9869281045751634\n",
      "Valid Epoch: 138 Loss: 0.2549625337123871,  Acc: 0.9176470588235295\n",
      "Epoch: 139 Loss: 0.1369064450263977,  Acc: 0.9869281045751634\n",
      "Valid Epoch: 139 Loss: 0.25297999382019043,  Acc: 0.9176470588235295\n",
      "Epoch: 140 Loss: 0.13520316779613495,  Acc: 0.9869281045751634\n",
      "Valid Epoch: 140 Loss: 0.2512972950935364,  Acc: 0.9176470588235295\n",
      "Epoch: 141 Loss: 0.1335616111755371,  Acc: 0.9869281045751634\n",
      "Valid Epoch: 141 Loss: 0.24941758811473846,  Acc: 0.9176470588235295\n",
      "Epoch: 142 Loss: 0.131939098238945,  Acc: 0.9869281045751634\n",
      "Valid Epoch: 142 Loss: 0.24791401624679565,  Acc: 0.9176470588235295\n",
      "Epoch: 143 Loss: 0.1303391009569168,  Acc: 0.9869281045751634\n",
      "Valid Epoch: 143 Loss: 0.24627503752708435,  Acc: 0.9176470588235295\n",
      "Epoch: 144 Loss: 0.12880316376686096,  Acc: 0.9869281045751634\n",
      "Valid Epoch: 144 Loss: 0.24470624327659607,  Acc: 0.9176470588235295\n",
      "Epoch: 145 Loss: 0.12729421257972717,  Acc: 0.9869281045751634\n",
      "Valid Epoch: 145 Loss: 0.24303656816482544,  Acc: 0.9176470588235295\n",
      "Epoch: 146 Loss: 0.12577423453330994,  Acc: 0.9869281045751634\n",
      "Valid Epoch: 146 Loss: 0.24187761545181274,  Acc: 0.9176470588235295\n",
      "Epoch: 147 Loss: 0.12428110092878342,  Acc: 0.9875816993464053\n",
      "Valid Epoch: 147 Loss: 0.24056227505207062,  Acc: 0.9176470588235295\n",
      "Epoch: 148 Loss: 0.12282560765743256,  Acc: 0.9875816993464053\n",
      "Valid Epoch: 148 Loss: 0.23895254731178284,  Acc: 0.9176470588235295\n",
      "Epoch: 149 Loss: 0.12139015644788742,  Acc: 0.9875816993464053\n",
      "Valid Epoch: 149 Loss: 0.23756623268127441,  Acc: 0.9176470588235295\n",
      "Epoch: 150 Loss: 0.11997535824775696,  Acc: 0.9875816993464053\n",
      "Valid Epoch: 150 Loss: 0.2359524667263031,  Acc: 0.9235294117647059\n",
      "Epoch: 151 Loss: 0.11858394742012024,  Acc: 0.9875816993464053\n",
      "Valid Epoch: 151 Loss: 0.23494189977645874,  Acc: 0.9235294117647059\n",
      "Epoch: 152 Loss: 0.11722376942634583,  Acc: 0.9875816993464053\n",
      "Valid Epoch: 152 Loss: 0.23361782729625702,  Acc: 0.9235294117647059\n",
      "Epoch: 153 Loss: 0.11588034778833389,  Acc: 0.9875816993464053\n",
      "Valid Epoch: 153 Loss: 0.23241758346557617,  Acc: 0.9235294117647059\n",
      "Epoch: 154 Loss: 0.11456506699323654,  Acc: 0.9882352941176471\n",
      "Valid Epoch: 154 Loss: 0.23115265369415283,  Acc: 0.9235294117647059\n",
      "Epoch: 155 Loss: 0.11326905339956284,  Acc: 0.9882352941176471\n",
      "Valid Epoch: 155 Loss: 0.22986482083797455,  Acc: 0.9235294117647059\n",
      "Epoch: 156 Loss: 0.11200567334890366,  Acc: 0.9882352941176471\n",
      "Valid Epoch: 156 Loss: 0.22873006761074066,  Acc: 0.9235294117647059\n",
      "Epoch: 157 Loss: 0.11072423309087753,  Acc: 0.9908496732026144\n",
      "Valid Epoch: 157 Loss: 0.2277452051639557,  Acc: 0.9294117647058824\n",
      "Epoch: 158 Loss: 0.10951470583677292,  Acc: 0.9908496732026144\n",
      "Valid Epoch: 158 Loss: 0.22657543420791626,  Acc: 0.9294117647058824\n",
      "Epoch: 159 Loss: 0.10825855284929276,  Acc: 0.9908496732026144\n",
      "Valid Epoch: 159 Loss: 0.22539106011390686,  Acc: 0.9294117647058824\n",
      "Epoch: 160 Loss: 0.10706713795661926,  Acc: 0.9915032679738562\n",
      "Valid Epoch: 160 Loss: 0.22452712059020996,  Acc: 0.9294117647058824\n",
      "Epoch: 161 Loss: 0.1059352308511734,  Acc: 0.9915032679738562\n",
      "Valid Epoch: 161 Loss: 0.22328504920005798,  Acc: 0.9294117647058824\n",
      "Epoch: 162 Loss: 0.10472042858600616,  Acc: 0.9915032679738562\n",
      "Valid Epoch: 162 Loss: 0.22197362780570984,  Acc: 0.9294117647058824\n",
      "Epoch: 163 Loss: 0.10355833917856216,  Acc: 0.9915032679738562\n",
      "Valid Epoch: 163 Loss: 0.22112390398979187,  Acc: 0.9294117647058824\n",
      "Epoch: 164 Loss: 0.10243040323257446,  Acc: 0.9915032679738562\n",
      "Valid Epoch: 164 Loss: 0.22022601962089539,  Acc: 0.9294117647058824\n",
      "Epoch: 165 Loss: 0.10131946951150894,  Acc: 0.9928104575163399\n",
      "Valid Epoch: 165 Loss: 0.2190251648426056,  Acc: 0.9352941176470588\n",
      "Epoch: 166 Loss: 0.10024213790893555,  Acc: 0.9928104575163399\n",
      "Valid Epoch: 166 Loss: 0.2183973789215088,  Acc: 0.9352941176470588\n",
      "Epoch: 167 Loss: 0.09913402050733566,  Acc: 0.9928104575163399\n",
      "Valid Epoch: 167 Loss: 0.21710771322250366,  Acc: 0.9352941176470588\n",
      "Epoch: 168 Loss: 0.0981280505657196,  Acc: 0.9928104575163399\n",
      "Valid Epoch: 168 Loss: 0.2161230593919754,  Acc: 0.9352941176470588\n",
      "Epoch: 169 Loss: 0.09705422073602676,  Acc: 0.9928104575163399\n",
      "Valid Epoch: 169 Loss: 0.21535487473011017,  Acc: 0.9352941176470588\n",
      "Epoch: 170 Loss: 0.09603200852870941,  Acc: 0.9928104575163399\n",
      "Valid Epoch: 170 Loss: 0.21442624926567078,  Acc: 0.9352941176470588\n",
      "Epoch: 171 Loss: 0.09501675516366959,  Acc: 0.9928104575163399\n",
      "Valid Epoch: 171 Loss: 0.2134055197238922,  Acc: 0.9411764705882353\n",
      "Epoch: 172 Loss: 0.09400919824838638,  Acc: 0.9928104575163399\n",
      "Valid Epoch: 172 Loss: 0.21234393119812012,  Acc: 0.9352941176470588\n",
      "Epoch: 173 Loss: 0.09304890781641006,  Acc: 0.9928104575163399\n",
      "Valid Epoch: 173 Loss: 0.21170830726623535,  Acc: 0.9352941176470588\n",
      "Epoch: 174 Loss: 0.09207873791456223,  Acc: 0.9934640522875817\n",
      "Valid Epoch: 174 Loss: 0.2108563482761383,  Acc: 0.9352941176470588\n",
      "Epoch: 175 Loss: 0.0911579504609108,  Acc: 0.9941176470588236\n",
      "Valid Epoch: 175 Loss: 0.2095406949520111,  Acc: 0.9352941176470588\n",
      "Epoch: 176 Loss: 0.090225949883461,  Acc: 0.9941176470588236\n",
      "Valid Epoch: 176 Loss: 0.20909976959228516,  Acc: 0.9352941176470588\n",
      "Epoch: 177 Loss: 0.08931359648704529,  Acc: 0.9941176470588236\n",
      "Valid Epoch: 177 Loss: 0.20789650082588196,  Acc: 0.9411764705882353\n",
      "Epoch: 178 Loss: 0.08841031044721603,  Acc: 0.9941176470588236\n",
      "Valid Epoch: 178 Loss: 0.20744457840919495,  Acc: 0.9411764705882353\n",
      "Epoch: 179 Loss: 0.08749452978372574,  Acc: 0.9947712418300654\n",
      "Valid Epoch: 179 Loss: 0.20665407180786133,  Acc: 0.9411764705882353\n",
      "Epoch: 180 Loss: 0.08666286617517471,  Acc: 0.9947712418300654\n",
      "Valid Epoch: 180 Loss: 0.20580805838108063,  Acc: 0.9352941176470588\n",
      "Epoch: 181 Loss: 0.08578220009803772,  Acc: 0.9947712418300654\n",
      "Valid Epoch: 181 Loss: 0.20470671355724335,  Acc: 0.9411764705882353\n",
      "Epoch: 182 Loss: 0.08492087572813034,  Acc: 0.9947712418300654\n",
      "Valid Epoch: 182 Loss: 0.2041240632534027,  Acc: 0.9411764705882353\n",
      "Epoch: 183 Loss: 0.08408758789300919,  Acc: 0.9947712418300654\n",
      "Valid Epoch: 183 Loss: 0.20340368151664734,  Acc: 0.9411764705882353\n",
      "Epoch: 184 Loss: 0.08327286690473557,  Acc: 0.9947712418300654\n",
      "Valid Epoch: 184 Loss: 0.20244809985160828,  Acc: 0.9411764705882353\n",
      "Epoch: 185 Loss: 0.08245164155960083,  Acc: 0.9947712418300654\n",
      "Valid Epoch: 185 Loss: 0.20198071002960205,  Acc: 0.9411764705882353\n",
      "Epoch: 186 Loss: 0.08166287839412689,  Acc: 0.9947712418300654\n",
      "Valid Epoch: 186 Loss: 0.20107053220272064,  Acc: 0.9411764705882353\n",
      "Epoch: 187 Loss: 0.08086422830820084,  Acc: 0.9954248366013072\n",
      "Valid Epoch: 187 Loss: 0.20055663585662842,  Acc: 0.9411764705882353\n",
      "Epoch: 188 Loss: 0.08007602393627167,  Acc: 0.9954248366013072\n",
      "Valid Epoch: 188 Loss: 0.19953618943691254,  Acc: 0.9411764705882353\n",
      "Epoch: 189 Loss: 0.07932848483324051,  Acc: 0.996078431372549\n",
      "Valid Epoch: 189 Loss: 0.19867956638336182,  Acc: 0.9411764705882353\n",
      "Epoch: 190 Loss: 0.0785733237862587,  Acc: 0.996078431372549\n",
      "Valid Epoch: 190 Loss: 0.1983945071697235,  Acc: 0.9411764705882353\n",
      "Epoch: 191 Loss: 0.07779208570718765,  Acc: 0.996078431372549\n",
      "Valid Epoch: 191 Loss: 0.19746588170528412,  Acc: 0.9411764705882353\n",
      "Epoch: 192 Loss: 0.07708705961704254,  Acc: 0.996078431372549\n",
      "Valid Epoch: 192 Loss: 0.19648776948451996,  Acc: 0.9411764705882353\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch: 193 Loss: 0.07636389881372452,  Acc: 0.996078431372549\n",
      "Valid Epoch: 193 Loss: 0.19602662324905396,  Acc: 0.9411764705882353\n",
      "Epoch: 194 Loss: 0.07563059777021408,  Acc: 0.9967320261437909\n",
      "Valid Epoch: 194 Loss: 0.19547201693058014,  Acc: 0.9411764705882353\n",
      "Epoch: 195 Loss: 0.07492925971746445,  Acc: 0.9967320261437909\n",
      "Valid Epoch: 195 Loss: 0.19460687041282654,  Acc: 0.9411764705882353\n",
      "Epoch: 196 Loss: 0.07423467934131622,  Acc: 0.9967320261437909\n",
      "Valid Epoch: 196 Loss: 0.19400736689567566,  Acc: 0.9411764705882353\n",
      "Epoch: 197 Loss: 0.07354208827018738,  Acc: 0.9967320261437909\n",
      "Valid Epoch: 197 Loss: 0.19311553239822388,  Acc: 0.9411764705882353\n",
      "Epoch: 198 Loss: 0.07284627854824066,  Acc: 0.9967320261437909\n",
      "Valid Epoch: 198 Loss: 0.192891463637352,  Acc: 0.9411764705882353\n",
      "Epoch: 199 Loss: 0.07218281179666519,  Acc: 0.9967320261437909\n",
      "Valid Epoch: 199 Loss: 0.19212201237678528,  Acc: 0.9411764705882353\n",
      "MCDWQ21YIYQV7DJ1VVPHY19_5QMQQXUI8DKEDDF6EQQ9KZ187NOCO5EY_YS9D6R65PU3W7YUKQ93YID8UH7P8ZNBWV8BJEGROUTO\n",
      "0.19\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.19"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from train import trainB, valB, predictB\n",
    "\n",
    "for i in range(200):\n",
    "    trainB(i)\n",
    "    valB(i)\n",
    "predictB()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "scrolled": true,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vanilla(\n",
      "  (conv): Sequential(\n",
      "    (0): Conv1d(64, 5, kernel_size=(5,), stride=(1,), padding=(2,))\n",
      "    (1): MaxPool1d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n",
      "    (2): ReLU()\n",
      "  )\n",
      "  (fc): Sequential(\n",
      "    (0): Linear(in_features=600, out_features=30, bias=True)\n",
      "    (1): Dropout(p=0.5)\n",
      "    (2): ReLU()\n",
      "  )\n",
      "  (out): Sequential(\n",
      "    (0): Linear(in_features=30, out_features=2, bias=True)\n",
      "    (1): Dropout(p=0.5)\n",
      "  )\n",
      ")\n"
     ]
    }
   ],
   "source": [
    "from Model import Vanilla\n",
    "\n",
    "model = Vanilla()\n",
    "print(model)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "scrolled": true,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch: 0 Loss: 0.7257917523384094,  Acc: 0.4784313725490197\n",
      "Valid Epoch: 0 Loss: 0.6836549639701843,  Acc: 0.5647058823529412\n",
      "Epoch: 1 Loss: 0.6975780725479126,  Acc: 0.5\n",
      "Valid Epoch: 1 Loss: 0.6790062189102173,  Acc: 0.5823529411764706\n",
      "Epoch: 2 Loss: 0.6914223432540894,  Acc: 0.5228758169934641\n",
      "Valid Epoch: 2 Loss: 0.6675114035606384,  Acc: 0.6588235294117647\n",
      "Epoch: 3 Loss: 0.6753295063972473,  Acc: 0.550326797385621\n",
      "Valid Epoch: 3 Loss: 0.6536793112754822,  Acc: 0.7058823529411765\n",
      "Epoch: 4 Loss: 0.6648760437965393,  Acc: 0.5705882352941175\n",
      "Valid Epoch: 4 Loss: 0.6291052103042603,  Acc: 0.7411764705882353\n",
      "Epoch: 5 Loss: 0.6560572385787964,  Acc: 0.5849673202614378\n",
      "Valid Epoch: 5 Loss: 0.6064677834510803,  Acc: 0.7705882352941176\n",
      "Epoch: 6 Loss: 0.6361625790596008,  Acc: 0.6267973856209149\n",
      "Valid Epoch: 6 Loss: 0.5733115077018738,  Acc: 0.788235294117647\n",
      "Epoch: 7 Loss: 0.6128259301185608,  Acc: 0.6411764705882352\n",
      "Valid Epoch: 7 Loss: 0.5233777761459351,  Acc: 0.8176470588235294\n",
      "Epoch: 8 Loss: 0.5883578658103943,  Acc: 0.6699346405228757\n",
      "Valid Epoch: 8 Loss: 0.4569826126098633,  Acc: 0.8705882352941177\n",
      "Epoch: 9 Loss: 0.5263983607292175,  Acc: 0.7078431372549018\n",
      "Valid Epoch: 9 Loss: 0.387948602437973,  Acc: 0.8823529411764706\n",
      "Epoch: 10 Loss: 0.48735037446022034,  Acc: 0.7372549019607845\n",
      "Valid Epoch: 10 Loss: 0.3391594886779785,  Acc: 0.9235294117647059\n",
      "Epoch: 11 Loss: 0.46722596883773804,  Acc: 0.7522875816993465\n",
      "Valid Epoch: 11 Loss: 0.2761448919773102,  Acc: 0.9352941176470588\n",
      "Epoch: 12 Loss: 0.43122974038124084,  Acc: 0.7771241830065361\n",
      "Valid Epoch: 12 Loss: 0.24254760146141052,  Acc: 0.9588235294117646\n",
      "Epoch: 13 Loss: 0.41227713227272034,  Acc: 0.7823529411764708\n",
      "Valid Epoch: 13 Loss: 0.21204787492752075,  Acc: 0.9529411764705882\n",
      "Epoch: 14 Loss: 0.41047725081443787,  Acc: 0.7738562091503268\n",
      "Valid Epoch: 14 Loss: 0.20277096331119537,  Acc: 0.9647058823529412\n",
      "Epoch: 15 Loss: 0.357034832239151,  Acc: 0.8039215686274512\n",
      "Valid Epoch: 15 Loss: 0.15635478496551514,  Acc: 0.9705882352941176\n",
      "Epoch: 16 Loss: 0.3360308110713959,  Acc: 0.8143790849673205\n",
      "Valid Epoch: 16 Loss: 0.14067551493644714,  Acc: 0.9705882352941176\n",
      "Epoch: 17 Loss: 0.3273047208786011,  Acc: 0.8294117647058825\n",
      "Valid Epoch: 17 Loss: 0.1321316361427307,  Acc: 0.9705882352941176\n",
      "Epoch: 18 Loss: 0.32316288352012634,  Acc: 0.8222222222222223\n",
      "Valid Epoch: 18 Loss: 0.13522052764892578,  Acc: 0.9764705882352941\n",
      "Epoch: 19 Loss: 0.3193579912185669,  Acc: 0.8333333333333335\n",
      "Valid Epoch: 19 Loss: 0.11699429154396057,  Acc: 0.9823529411764707\n",
      "Epoch: 20 Loss: 0.30339664220809937,  Acc: 0.8248366013071897\n",
      "Valid Epoch: 20 Loss: 0.124269038438797,  Acc: 0.9647058823529412\n",
      "Epoch: 21 Loss: 0.2938777506351471,  Acc: 0.8294117647058825\n",
      "Valid Epoch: 21 Loss: 0.10265137255191803,  Acc: 0.9705882352941176\n",
      "Epoch: 22 Loss: 0.2790773808956146,  Acc: 0.8477124183006537\n",
      "Valid Epoch: 22 Loss: 0.1043081134557724,  Acc: 0.9705882352941176\n",
      "Epoch: 23 Loss: 0.28762832283973694,  Acc: 0.8385620915032681\n",
      "Valid Epoch: 23 Loss: 0.10702984780073166,  Acc: 0.9647058823529412\n",
      "Epoch: 24 Loss: 0.275590181350708,  Acc: 0.8457516339869283\n",
      "Valid Epoch: 24 Loss: 0.08794516324996948,  Acc: 0.9823529411764707\n",
      "Epoch: 25 Loss: 0.2751014530658722,  Acc: 0.8457516339869282\n",
      "Valid Epoch: 25 Loss: 0.08807231485843658,  Acc: 0.9705882352941176\n",
      "Epoch: 26 Loss: 0.26067808270454407,  Acc: 0.8535947712418303\n",
      "Valid Epoch: 26 Loss: 0.08268633484840393,  Acc: 0.9764705882352941\n",
      "Epoch: 27 Loss: 0.2655104398727417,  Acc: 0.8372549019607844\n",
      "Valid Epoch: 27 Loss: 0.08535616844892502,  Acc: 0.9647058823529412\n",
      "Epoch: 28 Loss: 0.27887046337127686,  Acc: 0.8294117647058825\n",
      "Valid Epoch: 28 Loss: 0.07122054696083069,  Acc: 0.9764705882352941\n",
      "Epoch: 29 Loss: 0.26712632179260254,  Acc: 0.8424836601307192\n",
      "Valid Epoch: 29 Loss: 0.07693776488304138,  Acc: 0.9764705882352941\n",
      "Epoch: 30 Loss: 0.2795633375644684,  Acc: 0.847058823529412\n",
      "Valid Epoch: 30 Loss: 0.06588071584701538,  Acc: 0.9823529411764707\n",
      "Epoch: 31 Loss: 0.25056877732276917,  Acc: 0.8522875816993465\n",
      "Valid Epoch: 31 Loss: 0.0724802240729332,  Acc: 0.9764705882352941\n",
      "Epoch: 32 Loss: 0.23364832997322083,  Acc: 0.8588235294117649\n",
      "Valid Epoch: 32 Loss: 0.06538590788841248,  Acc: 0.9764705882352941\n",
      "Epoch: 33 Loss: 0.2516035735607147,  Acc: 0.8405228758169937\n",
      "Valid Epoch: 33 Loss: 0.06032710522413254,  Acc: 0.9823529411764707\n",
      "Epoch: 34 Loss: 0.251560777425766,  Acc: 0.8575163398692811\n",
      "Valid Epoch: 34 Loss: 0.060815904289484024,  Acc: 0.9823529411764707\n",
      "Epoch: 35 Loss: 0.25229036808013916,  Acc: 0.8673202614379086\n",
      "Valid Epoch: 35 Loss: 0.06697633117437363,  Acc: 0.9823529411764707\n",
      "Epoch: 36 Loss: 0.23604072630405426,  Acc: 0.8542483660130721\n",
      "Valid Epoch: 36 Loss: 0.0518808513879776,  Acc: 0.9882352941176471\n",
      "Epoch: 37 Loss: 0.23653537034988403,  Acc: 0.8614379084967322\n",
      "Valid Epoch: 37 Loss: 0.06829091906547546,  Acc: 0.9764705882352941\n",
      "Epoch: 38 Loss: 0.23074772953987122,  Acc: 0.8640522875816995\n",
      "Valid Epoch: 38 Loss: 0.06014121323823929,  Acc: 0.9764705882352941\n",
      "Epoch: 39 Loss: 0.23667651414871216,  Acc: 0.847058823529412\n",
      "Valid Epoch: 39 Loss: 0.056492023169994354,  Acc: 0.9823529411764707\n",
      "Epoch: 40 Loss: 0.2505474090576172,  Acc: 0.8339869281045753\n",
      "Valid Epoch: 40 Loss: 0.052629925310611725,  Acc: 0.9823529411764707\n",
      "Epoch: 41 Loss: 0.22898820042610168,  Acc: 0.8673202614379086\n",
      "Valid Epoch: 41 Loss: 0.05489746853709221,  Acc: 0.9823529411764707\n",
      "Epoch: 42 Loss: 0.22947703301906586,  Acc: 0.8535947712418303\n",
      "Valid Epoch: 42 Loss: 0.044881995767354965,  Acc: 0.9882352941176471\n",
      "Epoch: 43 Loss: 0.22482186555862427,  Acc: 0.8673202614379089\n",
      "Valid Epoch: 43 Loss: 0.0520024448633194,  Acc: 0.9823529411764707\n",
      "Epoch: 44 Loss: 0.21873539686203003,  Acc: 0.8601307189542485\n",
      "Valid Epoch: 44 Loss: 0.04332761466503143,  Acc: 0.9882352941176471\n",
      "Epoch: 45 Loss: 0.22291326522827148,  Acc: 0.8568627450980393\n",
      "Valid Epoch: 45 Loss: 0.04195152223110199,  Acc: 0.9882352941176471\n",
      "Epoch: 46 Loss: 0.2349255383014679,  Acc: 0.8522875816993465\n",
      "Valid Epoch: 46 Loss: 0.040755338966846466,  Acc: 0.9882352941176471\n",
      "Epoch: 47 Loss: 0.23343759775161743,  Acc: 0.8555555555555557\n",
      "Valid Epoch: 47 Loss: 0.047422394156455994,  Acc: 0.9882352941176471\n",
      "Epoch: 48 Loss: 0.2213507741689682,  Acc: 0.8607843137254904\n",
      "Valid Epoch: 48 Loss: 0.03912318870425224,  Acc: 0.9882352941176471\n",
      "Epoch: 49 Loss: 0.2198827564716339,  Acc: 0.8614379084967322\n",
      "Valid Epoch: 49 Loss: 0.043569520115852356,  Acc: 0.9882352941176471\n",
      "Epoch: 50 Loss: 0.19867074489593506,  Acc: 0.8810457516339871\n",
      "Valid Epoch: 50 Loss: 0.04109235852956772,  Acc: 0.9882352941176471\n",
      "Epoch: 51 Loss: 0.22732622921466827,  Acc: 0.8535947712418303\n",
      "Valid Epoch: 51 Loss: 0.045095860958099365,  Acc: 0.9882352941176471\n",
      "Epoch: 52 Loss: 0.21339376270771027,  Acc: 0.8633986928104577\n",
      "Valid Epoch: 52 Loss: 0.041945915669202805,  Acc: 0.9882352941176471\n",
      "Epoch: 53 Loss: 0.2104993611574173,  Acc: 0.8581699346405229\n",
      "Valid Epoch: 53 Loss: 0.05553416907787323,  Acc: 0.9764705882352941\n",
      "Epoch: 54 Loss: 0.2140989601612091,  Acc: 0.8601307189542485\n",
      "Valid Epoch: 54 Loss: 0.037159182131290436,  Acc: 0.9882352941176471\n",
      "Epoch: 55 Loss: 0.2104126363992691,  Acc: 0.8653594771241833\n",
      "Valid Epoch: 55 Loss: 0.04027003049850464,  Acc: 0.9882352941176471\n",
      "Epoch: 56 Loss: 0.20266921818256378,  Acc: 0.8522875816993467\n",
      "Valid Epoch: 56 Loss: 0.037113964557647705,  Acc: 0.9882352941176471\n",
      "Epoch: 57 Loss: 0.19993875920772552,  Acc: 0.8686274509803923\n",
      "Valid Epoch: 57 Loss: 0.03572745621204376,  Acc: 0.9882352941176471\n",
      "Epoch: 58 Loss: 0.2188127189874649,  Acc: 0.8633986928104577\n",
      "Valid Epoch: 58 Loss: 0.03340810909867287,  Acc: 0.9882352941176471\n",
      "Epoch: 59 Loss: 0.214333638548851,  Acc: 0.8535947712418303\n",
      "Valid Epoch: 59 Loss: 0.03174213692545891,  Acc: 0.9882352941176471\n",
      "Epoch: 60 Loss: 0.2034071683883667,  Acc: 0.8660130718954251\n",
      "Valid Epoch: 60 Loss: 0.030744437128305435,  Acc: 0.9882352941176471\n",
      "Epoch: 61 Loss: 0.20428600907325745,  Acc: 0.8653594771241832\n",
      "Valid Epoch: 61 Loss: 0.03169484809041023,  Acc: 0.9882352941176471\n",
      "Epoch: 62 Loss: 0.1958523541688919,  Acc: 0.8712418300653596\n",
      "Valid Epoch: 62 Loss: 0.036099258810281754,  Acc: 0.9882352941176471\n",
      "Epoch: 63 Loss: 0.21560490131378174,  Acc: 0.8666666666666667\n",
      "Valid Epoch: 63 Loss: 0.030915960669517517,  Acc: 0.9882352941176471\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch: 64 Loss: 0.20038852095603943,  Acc: 0.8764705882352943\n",
      "Valid Epoch: 64 Loss: 0.028528816998004913,  Acc: 0.9941176470588236\n",
      "Epoch: 65 Loss: 0.1823613941669464,  Acc: 0.8810457516339871\n",
      "Valid Epoch: 65 Loss: 0.030354630202054977,  Acc: 0.9882352941176471\n",
      "Epoch: 66 Loss: 0.18597275018692017,  Acc: 0.877124183006536\n",
      "Valid Epoch: 66 Loss: 0.02913111075758934,  Acc: 0.9882352941176471\n",
      "Epoch: 67 Loss: 0.21818019449710846,  Acc: 0.8535947712418303\n",
      "Valid Epoch: 67 Loss: 0.02892448380589485,  Acc: 0.9882352941176471\n",
      "Epoch: 68 Loss: 0.20664484798908234,  Acc: 0.8653594771241832\n",
      "Valid Epoch: 68 Loss: 0.02887750416994095,  Acc: 0.9882352941176471\n",
      "Epoch: 69 Loss: 0.19757649302482605,  Acc: 0.8745098039215689\n",
      "Valid Epoch: 69 Loss: 0.027157170698046684,  Acc: 0.9882352941176471\n",
      "Epoch: 70 Loss: 0.18422313034534454,  Acc: 0.8797385620915035\n",
      "Valid Epoch: 70 Loss: 0.03178649768233299,  Acc: 0.9882352941176471\n",
      "Epoch: 71 Loss: 0.1800057590007782,  Acc: 0.8843137254901962\n",
      "Valid Epoch: 71 Loss: 0.029092032462358475,  Acc: 0.9882352941176471\n",
      "Epoch: 72 Loss: 0.19151736795902252,  Acc: 0.8679738562091505\n",
      "Valid Epoch: 72 Loss: 0.033912770450115204,  Acc: 0.9882352941176471\n",
      "Epoch: 73 Loss: 0.19036975502967834,  Acc: 0.8732026143790851\n",
      "Valid Epoch: 73 Loss: 0.029193401336669922,  Acc: 0.9882352941176471\n",
      "Epoch: 74 Loss: 0.18500275909900665,  Acc: 0.8816993464052288\n",
      "Valid Epoch: 74 Loss: 0.029165171086788177,  Acc: 0.9882352941176471\n",
      "Epoch: 75 Loss: 0.18706203997135162,  Acc: 0.877777777777778\n",
      "Valid Epoch: 75 Loss: 0.02508518658578396,  Acc: 0.9882352941176471\n",
      "Epoch: 76 Loss: 0.20000971853733063,  Acc: 0.8718954248366014\n",
      "Valid Epoch: 76 Loss: 0.024995867162942886,  Acc: 0.9882352941176471\n",
      "Epoch: 77 Loss: 0.18208667635917664,  Acc: 0.8790849673202616\n",
      "Valid Epoch: 77 Loss: 0.026000317186117172,  Acc: 0.9882352941176471\n",
      "Epoch: 78 Loss: 0.19877195358276367,  Acc: 0.8692810457516342\n",
      "Valid Epoch: 78 Loss: 0.0369487963616848,  Acc: 0.9882352941176471\n",
      "Epoch: 79 Loss: 0.19367273151874542,  Acc: 0.8705882352941178\n",
      "Valid Epoch: 79 Loss: 0.02320260740816593,  Acc: 0.9941176470588236\n",
      "Epoch: 80 Loss: 0.1904190331697464,  Acc: 0.8882352941176472\n",
      "Valid Epoch: 80 Loss: 0.02639142796397209,  Acc: 0.9882352941176471\n",
      "Epoch: 81 Loss: 0.20299196243286133,  Acc: 0.8640522875816995\n",
      "Valid Epoch: 81 Loss: 0.02405840903520584,  Acc: 0.9882352941176471\n",
      "Epoch: 82 Loss: 0.20035327970981598,  Acc: 0.8575163398692812\n",
      "Valid Epoch: 82 Loss: 0.028441548347473145,  Acc: 0.9882352941176471\n",
      "Epoch: 83 Loss: 0.19945739209651947,  Acc: 0.8535947712418301\n",
      "Valid Epoch: 83 Loss: 0.022166844457387924,  Acc: 0.9941176470588236\n",
      "Epoch: 84 Loss: 0.18615175783634186,  Acc: 0.877124183006536\n",
      "Valid Epoch: 84 Loss: 0.026279915124177933,  Acc: 0.9941176470588236\n",
      "Epoch: 85 Loss: 0.18549522757530212,  Acc: 0.8686274509803923\n",
      "Valid Epoch: 85 Loss: 0.027964115142822266,  Acc: 0.9882352941176471\n",
      "Epoch: 86 Loss: 0.1928493082523346,  Acc: 0.866013071895425\n",
      "Valid Epoch: 86 Loss: 0.02594570443034172,  Acc: 0.9882352941176471\n",
      "Epoch: 87 Loss: 0.18849167227745056,  Acc: 0.8633986928104577\n",
      "Valid Epoch: 87 Loss: 0.02731534093618393,  Acc: 0.9882352941176471\n",
      "Epoch: 88 Loss: 0.18934230506420135,  Acc: 0.8679738562091506\n",
      "Valid Epoch: 88 Loss: 0.024088207632303238,  Acc: 0.9882352941176471\n",
      "Epoch: 89 Loss: 0.20417794585227966,  Acc: 0.8751633986928106\n",
      "Valid Epoch: 89 Loss: 0.028854699805378914,  Acc: 0.9882352941176471\n",
      "Epoch: 90 Loss: 0.20222921669483185,  Acc: 0.8738562091503269\n",
      "Valid Epoch: 90 Loss: 0.0235066469758749,  Acc: 0.9941176470588236\n",
      "Epoch: 91 Loss: 0.1907394528388977,  Acc: 0.8725490196078433\n",
      "Valid Epoch: 91 Loss: 0.02596862241625786,  Acc: 0.9882352941176471\n",
      "Epoch: 92 Loss: 0.19010663032531738,  Acc: 0.8581699346405232\n",
      "Valid Epoch: 92 Loss: 0.024638621136546135,  Acc: 0.9941176470588236\n",
      "Epoch: 93 Loss: 0.18845388293266296,  Acc: 0.8705882352941178\n",
      "Valid Epoch: 93 Loss: 0.02467203140258789,  Acc: 0.9941176470588236\n",
      "Epoch: 94 Loss: 0.18445435166358948,  Acc: 0.8732026143790852\n",
      "Valid Epoch: 94 Loss: 0.02238279953598976,  Acc: 0.9941176470588236\n",
      "Epoch: 95 Loss: 0.2031480073928833,  Acc: 0.866013071895425\n",
      "Valid Epoch: 95 Loss: 0.022280309349298477,  Acc: 0.9941176470588236\n",
      "Epoch: 96 Loss: 0.17968933284282684,  Acc: 0.8764705882352942\n",
      "Valid Epoch: 96 Loss: 0.027139414101839066,  Acc: 0.9882352941176471\n",
      "Epoch: 97 Loss: 0.18196842074394226,  Acc: 0.8653594771241832\n",
      "Valid Epoch: 97 Loss: 0.020648492500185966,  Acc: 0.9941176470588236\n",
      "Epoch: 98 Loss: 0.18233920633792877,  Acc: 0.8679738562091505\n",
      "Valid Epoch: 98 Loss: 0.024562712758779526,  Acc: 0.9941176470588236\n",
      "Epoch: 99 Loss: 0.18905530869960785,  Acc: 0.8679738562091505\n",
      "Valid Epoch: 99 Loss: 0.019303716719150543,  Acc: 0.9941176470588236\n",
      "Epoch: 100 Loss: 0.17423290014266968,  Acc: 0.8875816993464055\n",
      "Valid Epoch: 100 Loss: 0.02261159010231495,  Acc: 0.9941176470588236\n",
      "Epoch: 101 Loss: 0.1848282516002655,  Acc: 0.877777777777778\n",
      "Valid Epoch: 101 Loss: 0.021633952856063843,  Acc: 0.9941176470588236\n",
      "Epoch: 102 Loss: 0.17526347935199738,  Acc: 0.873856209150327\n",
      "Valid Epoch: 102 Loss: 0.02288178727030754,  Acc: 0.9941176470588236\n",
      "Epoch: 103 Loss: 0.18713520467281342,  Acc: 0.8751633986928106\n",
      "Valid Epoch: 103 Loss: 0.019320359453558922,  Acc: 0.9941176470588236\n",
      "Epoch: 104 Loss: 0.18967844545841217,  Acc: 0.8712418300653596\n",
      "Valid Epoch: 104 Loss: 0.02070077508687973,  Acc: 0.9941176470588236\n",
      "Epoch: 105 Loss: 0.1828170269727707,  Acc: 0.8712418300653596\n",
      "Valid Epoch: 105 Loss: 0.018271442502737045,  Acc: 0.9941176470588236\n",
      "Epoch: 106 Loss: 0.18306906521320343,  Acc: 0.8718954248366014\n",
      "Valid Epoch: 106 Loss: 0.020771633833646774,  Acc: 0.9941176470588236\n",
      "Epoch: 107 Loss: 0.18197259306907654,  Acc: 0.8686274509803923\n",
      "Valid Epoch: 107 Loss: 0.017453892156481743,  Acc: 0.9941176470588236\n",
      "Epoch: 108 Loss: 0.17613571882247925,  Acc: 0.8790849673202615\n",
      "Valid Epoch: 108 Loss: 0.022937068715691566,  Acc: 0.9941176470588236\n",
      "Epoch: 109 Loss: 0.18538908660411835,  Acc: 0.8790849673202615\n",
      "Valid Epoch: 109 Loss: 0.020169179886579514,  Acc: 0.9941176470588236\n",
      "Epoch: 110 Loss: 0.19491437077522278,  Acc: 0.8594771241830067\n",
      "Valid Epoch: 110 Loss: 0.0198528990149498,  Acc: 0.9941176470588236\n",
      "Epoch: 111 Loss: 0.17547835409641266,  Acc: 0.8797385620915035\n",
      "Valid Epoch: 111 Loss: 0.017863204702734947,  Acc: 0.9941176470588236\n",
      "Epoch: 112 Loss: 0.17872044444084167,  Acc: 0.8745098039215689\n",
      "Valid Epoch: 112 Loss: 0.023201333358883858,  Acc: 0.9941176470588236\n",
      "Epoch: 113 Loss: 0.1835707575082779,  Acc: 0.8797385620915036\n",
      "Valid Epoch: 113 Loss: 0.018099619075655937,  Acc: 0.9941176470588236\n",
      "Epoch: 114 Loss: 0.19624502956867218,  Acc: 0.8686274509803922\n",
      "Valid Epoch: 114 Loss: 0.02411852404475212,  Acc: 0.9882352941176471\n",
      "Epoch: 115 Loss: 0.17706328630447388,  Acc: 0.8823529411764708\n",
      "Valid Epoch: 115 Loss: 0.016714192926883698,  Acc: 0.9941176470588236\n",
      "Epoch: 116 Loss: 0.187226802110672,  Acc: 0.8712418300653596\n",
      "Valid Epoch: 116 Loss: 0.016915610060095787,  Acc: 0.9941176470588236\n",
      "Epoch: 117 Loss: 0.19534805417060852,  Acc: 0.8738562091503271\n",
      "Valid Epoch: 117 Loss: 0.01844208687543869,  Acc: 0.9941176470588236\n",
      "Epoch: 118 Loss: 0.17792730033397675,  Acc: 0.858169934640523\n",
      "Valid Epoch: 118 Loss: 0.02020426280796528,  Acc: 0.9941176470588236\n",
      "Epoch: 119 Loss: 0.1872534602880478,  Acc: 0.8588235294117648\n",
      "Valid Epoch: 119 Loss: 0.01947895996272564,  Acc: 0.9941176470588236\n",
      "Epoch: 120 Loss: 0.1770479381084442,  Acc: 0.873856209150327\n",
      "Valid Epoch: 120 Loss: 0.018422333523631096,  Acc: 0.9941176470588236\n",
      "Epoch: 121 Loss: 0.2044122815132141,  Acc: 0.8522875816993466\n",
      "Valid Epoch: 121 Loss: 0.01812591217458248,  Acc: 0.9941176470588236\n",
      "Epoch: 122 Loss: 0.181987464427948,  Acc: 0.8843137254901963\n",
      "Valid Epoch: 122 Loss: 0.020085565745830536,  Acc: 0.9941176470588236\n",
      "Epoch: 123 Loss: 0.19873902201652527,  Acc: 0.854901960784314\n",
      "Valid Epoch: 123 Loss: 0.01867787539958954,  Acc: 0.9941176470588236\n",
      "Epoch: 124 Loss: 0.19287310540676117,  Acc: 0.8771241830065363\n",
      "Valid Epoch: 124 Loss: 0.0167496670037508,  Acc: 0.9941176470588236\n",
      "Epoch: 125 Loss: 0.17620715498924255,  Acc: 0.873856209150327\n",
      "Valid Epoch: 125 Loss: 0.019478648900985718,  Acc: 0.9941176470588236\n",
      "Epoch: 126 Loss: 0.17618849873542786,  Acc: 0.8797385620915034\n",
      "Valid Epoch: 126 Loss: 0.019888926297426224,  Acc: 0.9941176470588236\n",
      "Epoch: 127 Loss: 0.19168312847614288,  Acc: 0.8614379084967323\n",
      "Valid Epoch: 127 Loss: 0.021575188264250755,  Acc: 0.9941176470588236\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch: 128 Loss: 0.18811310827732086,  Acc: 0.8679738562091506\n",
      "Valid Epoch: 128 Loss: 0.01928548701107502,  Acc: 0.9941176470588236\n",
      "Epoch: 129 Loss: 0.18732500076293945,  Acc: 0.8725490196078433\n",
      "Valid Epoch: 129 Loss: 0.017819229513406754,  Acc: 0.9941176470588236\n",
      "Epoch: 130 Loss: 0.18020033836364746,  Acc: 0.8764705882352943\n",
      "Valid Epoch: 130 Loss: 0.018089674413204193,  Acc: 0.9941176470588236\n",
      "Epoch: 131 Loss: 0.1888342946767807,  Acc: 0.8705882352941179\n",
      "Valid Epoch: 131 Loss: 0.01639947108924389,  Acc: 0.9941176470588236\n",
      "Epoch: 132 Loss: 0.19379426538944244,  Acc: 0.8699346405228761\n",
      "Valid Epoch: 132 Loss: 0.020005129277706146,  Acc: 0.9941176470588236\n",
      "Epoch: 133 Loss: 0.188100203871727,  Acc: 0.8594771241830068\n",
      "Valid Epoch: 133 Loss: 0.017733639106154442,  Acc: 0.9941176470588236\n",
      "Epoch: 134 Loss: 0.18750539422035217,  Acc: 0.8660130718954251\n",
      "Valid Epoch: 134 Loss: 0.017383327707648277,  Acc: 0.9941176470588236\n",
      "Epoch: 135 Loss: 0.1844678372144699,  Acc: 0.8745098039215687\n",
      "Valid Epoch: 135 Loss: 0.015827510505914688,  Acc: 0.9941176470588236\n",
      "Epoch: 136 Loss: 0.18191960453987122,  Acc: 0.8620915032679739\n",
      "Valid Epoch: 136 Loss: 0.015896929427981377,  Acc: 0.9941176470588236\n",
      "Epoch: 137 Loss: 0.1655994951725006,  Acc: 0.8908496732026145\n",
      "Valid Epoch: 137 Loss: 0.017935045063495636,  Acc: 0.9941176470588236\n",
      "Epoch: 138 Loss: 0.1880880445241928,  Acc: 0.8679738562091505\n",
      "Valid Epoch: 138 Loss: 0.01844116486608982,  Acc: 0.9941176470588236\n",
      "Epoch: 139 Loss: 0.17668969929218292,  Acc: 0.8888888888888891\n",
      "Valid Epoch: 139 Loss: 0.016028139740228653,  Acc: 0.9941176470588236\n",
      "Epoch: 140 Loss: 0.1764797419309616,  Acc: 0.8836601307189543\n",
      "Valid Epoch: 140 Loss: 0.0183476060628891,  Acc: 0.9941176470588236\n",
      "Epoch: 141 Loss: 0.17660166323184967,  Acc: 0.8718954248366014\n",
      "Valid Epoch: 141 Loss: 0.018468156456947327,  Acc: 0.9941176470588236\n",
      "Epoch: 142 Loss: 0.17003391683101654,  Acc: 0.8843137254901963\n",
      "Valid Epoch: 142 Loss: 0.020543726161122322,  Acc: 0.9941176470588236\n",
      "Epoch: 143 Loss: 0.1812952309846878,  Acc: 0.8633986928104577\n",
      "Valid Epoch: 143 Loss: 0.017285598441958427,  Acc: 0.9941176470588236\n",
      "Epoch: 144 Loss: 0.17088580131530762,  Acc: 0.8771241830065362\n",
      "Valid Epoch: 144 Loss: 0.01753913424909115,  Acc: 0.9941176470588236\n",
      "Epoch: 145 Loss: 0.19742384552955627,  Acc: 0.8594771241830068\n",
      "Valid Epoch: 145 Loss: 0.020580586045980453,  Acc: 0.9941176470588236\n",
      "Epoch: 146 Loss: 0.17348875105381012,  Acc: 0.8751633986928106\n",
      "Valid Epoch: 146 Loss: 0.01908239908516407,  Acc: 0.9941176470588236\n",
      "Epoch: 147 Loss: 0.17778638005256653,  Acc: 0.877777777777778\n",
      "Valid Epoch: 147 Loss: 0.016967419534921646,  Acc: 0.9941176470588236\n",
      "Epoch: 148 Loss: 0.18854036927223206,  Acc: 0.8673202614379086\n",
      "Valid Epoch: 148 Loss: 0.020283635705709457,  Acc: 0.9941176470588236\n",
      "Epoch: 149 Loss: 0.18290123343467712,  Acc: 0.8718954248366015\n",
      "Valid Epoch: 149 Loss: 0.014213175512850285,  Acc: 0.9941176470588236\n",
      "MERMIROOMUHJPXJOHUVLEORZP3GLOO7AUFDKEFTWEOOALZOP9RNCGZEN1Y19EWX65QUYU7NAK_4SCJDVDNGRXODBEV2B5EFDIDNR\n",
      "0.96\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.96"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from train import trainB, valB, predictB\n",
    "\n",
    "for i in range(150):\n",
    "    trainB(i)\n",
    "    valB(i)\n",
    "predictB()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "scrolled": true,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch: 0 Loss: 0.7746022343635559,  Acc: 0.5091503267973855\n",
      "Valid Epoch: 0 Loss: 0.6691557765007019,  Acc: 0.6588235294117647\n",
      "Epoch: 1 Loss: 0.6671097874641418,  Acc: 0.5941176470588234\n",
      "Valid Epoch: 1 Loss: 0.6247886419296265,  Acc: 0.7235294117647059\n",
      "Epoch: 2 Loss: 0.6346470713615417,  Acc: 0.6084967320261436\n",
      "Valid Epoch: 2 Loss: 0.5626108646392822,  Acc: 0.8352941176470589\n",
      "Epoch: 3 Loss: 0.5858892798423767,  Acc: 0.668627450980392\n",
      "Valid Epoch: 3 Loss: 0.5025928020477295,  Acc: 0.8117647058823529\n",
      "Epoch: 4 Loss: 0.5427587032318115,  Acc: 0.6993464052287583\n",
      "Valid Epoch: 4 Loss: 0.45029416680336,  Acc: 0.8764705882352941\n",
      "Epoch: 5 Loss: 0.5027880072593689,  Acc: 0.7346405228758172\n",
      "Valid Epoch: 5 Loss: 0.39211100339889526,  Acc: 0.8823529411764706\n",
      "Epoch: 6 Loss: 0.47268763184547424,  Acc: 0.7633986928104576\n",
      "Valid Epoch: 6 Loss: 0.35563790798187256,  Acc: 0.8941176470588235\n",
      "Epoch: 7 Loss: 0.4419125020503998,  Acc: 0.7830065359477124\n",
      "Valid Epoch: 7 Loss: 0.2907485365867615,  Acc: 0.9176470588235295\n",
      "Epoch: 8 Loss: 0.39330387115478516,  Acc: 0.7836601307189545\n",
      "Valid Epoch: 8 Loss: 0.2540847063064575,  Acc: 0.9235294117647059\n",
      "Epoch: 9 Loss: 0.3904947340488434,  Acc: 0.7980392156862747\n",
      "Valid Epoch: 9 Loss: 0.2320854812860489,  Acc: 0.9352941176470588\n",
      "Epoch: 10 Loss: 0.371952623128891,  Acc: 0.8006535947712421\n",
      "Valid Epoch: 10 Loss: 0.21108180284500122,  Acc: 0.9470588235294117\n",
      "Epoch: 11 Loss: 0.34886452555656433,  Acc: 0.8169934640522878\n",
      "Valid Epoch: 11 Loss: 0.19707642495632172,  Acc: 0.9529411764705882\n",
      "Epoch: 12 Loss: 0.3259161114692688,  Acc: 0.827450980392157\n",
      "Valid Epoch: 12 Loss: 0.18623322248458862,  Acc: 0.9470588235294117\n",
      "Epoch: 13 Loss: 0.3230273723602295,  Acc: 0.816339869281046\n",
      "Valid Epoch: 13 Loss: 0.16302001476287842,  Acc: 0.9529411764705882\n",
      "Epoch: 14 Loss: 0.3249465525150299,  Acc: 0.827450980392157\n",
      "Valid Epoch: 14 Loss: 0.1565169095993042,  Acc: 0.9647058823529411\n",
      "Epoch: 15 Loss: 0.2921625077724457,  Acc: 0.8444444444444446\n",
      "Valid Epoch: 15 Loss: 0.14523562788963318,  Acc: 0.9588235294117646\n",
      "Epoch: 16 Loss: 0.29395630955696106,  Acc: 0.8372549019607844\n",
      "Valid Epoch: 16 Loss: 0.13717424869537354,  Acc: 0.9647058823529411\n",
      "Epoch: 17 Loss: 0.2887845039367676,  Acc: 0.8444444444444447\n",
      "Valid Epoch: 17 Loss: 0.12560348212718964,  Acc: 0.9705882352941176\n",
      "Epoch: 18 Loss: 0.28115665912628174,  Acc: 0.8366013071895426\n",
      "Valid Epoch: 18 Loss: 0.1164579764008522,  Acc: 0.9705882352941176\n",
      "Epoch: 19 Loss: 0.2694808542728424,  Acc: 0.8444444444444447\n",
      "Valid Epoch: 19 Loss: 0.10971906781196594,  Acc: 0.9647058823529411\n",
      "Epoch: 20 Loss: 0.27814167737960815,  Acc: 0.8385620915032681\n",
      "Valid Epoch: 20 Loss: 0.1103452742099762,  Acc: 0.9764705882352941\n",
      "Epoch: 21 Loss: 0.2706526815891266,  Acc: 0.8379084967320264\n",
      "Valid Epoch: 21 Loss: 0.09974804520606995,  Acc: 0.9647058823529411\n",
      "Epoch: 22 Loss: 0.2605810761451721,  Acc: 0.8496732026143793\n",
      "Valid Epoch: 22 Loss: 0.0948835164308548,  Acc: 0.9764705882352941\n",
      "Epoch: 23 Loss: 0.24734854698181152,  Acc: 0.8503267973856211\n",
      "Valid Epoch: 23 Loss: 0.09085088968276978,  Acc: 0.9764705882352941\n",
      "Epoch: 24 Loss: 0.2477233111858368,  Acc: 0.8555555555555556\n",
      "Valid Epoch: 24 Loss: 0.08383084833621979,  Acc: 0.9764705882352941\n",
      "Epoch: 25 Loss: 0.24613788723945618,  Acc: 0.854248366013072\n",
      "Valid Epoch: 25 Loss: 0.08138452470302582,  Acc: 0.9764705882352941\n",
      "Epoch: 26 Loss: 0.23935215175151825,  Acc: 0.8594771241830066\n",
      "Valid Epoch: 26 Loss: 0.0764777809381485,  Acc: 0.9764705882352941\n",
      "Epoch: 27 Loss: 0.23256026208400726,  Acc: 0.8542483660130721\n",
      "Valid Epoch: 27 Loss: 0.07518559694290161,  Acc: 0.9882352941176471\n",
      "Epoch: 28 Loss: 0.2304106056690216,  Acc: 0.8692810457516341\n",
      "Valid Epoch: 28 Loss: 0.08162204176187515,  Acc: 0.9882352941176471\n",
      "Epoch: 29 Loss: 0.22055546939373016,  Acc: 0.8725490196078434\n",
      "Valid Epoch: 29 Loss: 0.08107094466686249,  Acc: 0.9882352941176471\n",
      "Epoch: 30 Loss: 0.23857130110263824,  Acc: 0.8562091503267975\n",
      "Valid Epoch: 30 Loss: 0.06659530848264694,  Acc: 0.9764705882352941\n",
      "Epoch: 31 Loss: 0.23146364092826843,  Acc: 0.8633986928104577\n",
      "Valid Epoch: 31 Loss: 0.06504761427640915,  Acc: 0.9882352941176471\n",
      "Epoch: 32 Loss: 0.20783105492591858,  Acc: 0.8764705882352943\n",
      "Valid Epoch: 32 Loss: 0.06331423670053482,  Acc: 0.9882352941176471\n",
      "Epoch: 33 Loss: 0.21363307535648346,  Acc: 0.8647058823529413\n",
      "Valid Epoch: 33 Loss: 0.06136801838874817,  Acc: 0.9882352941176471\n",
      "Epoch: 34 Loss: 0.21698227524757385,  Acc: 0.8725490196078433\n",
      "Valid Epoch: 34 Loss: 0.061848416924476624,  Acc: 0.9882352941176471\n",
      "Epoch: 35 Loss: 0.21207931637763977,  Acc: 0.8732026143790851\n",
      "Valid Epoch: 35 Loss: 0.059470951557159424,  Acc: 0.9882352941176471\n",
      "Epoch: 36 Loss: 0.22251534461975098,  Acc: 0.8673202614379086\n",
      "Valid Epoch: 36 Loss: 0.057775676250457764,  Acc: 0.9882352941176471\n",
      "Epoch: 37 Loss: 0.20379941165447235,  Acc: 0.8660130718954249\n",
      "Valid Epoch: 37 Loss: 0.061859674751758575,  Acc: 0.9882352941176471\n",
      "Epoch: 38 Loss: 0.20612698793411255,  Acc: 0.8738562091503269\n",
      "Valid Epoch: 38 Loss: 0.059062398970127106,  Acc: 0.9882352941176471\n",
      "Epoch: 39 Loss: 0.2044822722673416,  Acc: 0.8745098039215689\n",
      "Valid Epoch: 39 Loss: 0.06246945261955261,  Acc: 0.9882352941176471\n",
      "Epoch: 40 Loss: 0.21092727780342102,  Acc: 0.866013071895425\n",
      "Valid Epoch: 40 Loss: 0.06596983224153519,  Acc: 0.9882352941176471\n",
      "Epoch: 41 Loss: 0.22296187281608582,  Acc: 0.8496732026143792\n",
      "Valid Epoch: 41 Loss: 0.06041041761636734,  Acc: 0.9882352941176471\n",
      "Epoch: 42 Loss: 0.20845235884189606,  Acc: 0.8771241830065362\n",
      "Valid Epoch: 42 Loss: 0.06016542762517929,  Acc: 0.9882352941176471\n",
      "Epoch: 43 Loss: 0.22517721354961395,  Acc: 0.8568627450980394\n",
      "Valid Epoch: 43 Loss: 0.06401854008436203,  Acc: 0.9882352941176471\n",
      "Epoch: 44 Loss: 0.21099953353405,  Acc: 0.8594771241830067\n",
      "Valid Epoch: 44 Loss: 0.055844586342573166,  Acc: 0.9882352941176471\n",
      "Epoch: 45 Loss: 0.21187371015548706,  Acc: 0.8614379084967322\n",
      "Valid Epoch: 45 Loss: 0.055691566318273544,  Acc: 0.9882352941176471\n",
      "Epoch: 46 Loss: 0.1975778341293335,  Acc: 0.8745098039215689\n",
      "Valid Epoch: 46 Loss: 0.05436959117650986,  Acc: 0.9882352941176471\n",
      "Epoch: 47 Loss: 0.20655830204486847,  Acc: 0.8686274509803923\n",
      "Valid Epoch: 47 Loss: 0.05745505169034004,  Acc: 0.9882352941176471\n",
      "Epoch: 48 Loss: 0.2315802276134491,  Acc: 0.8490196078431375\n",
      "Valid Epoch: 48 Loss: 0.05348572880029678,  Acc: 0.9882352941176471\n",
      "Epoch: 49 Loss: 0.18750739097595215,  Acc: 0.877777777777778\n",
      "Valid Epoch: 49 Loss: 0.05410778522491455,  Acc: 0.9882352941176471\n",
      "Epoch: 50 Loss: 0.19965358078479767,  Acc: 0.873856209150327\n",
      "Valid Epoch: 50 Loss: 0.06140877678990364,  Acc: 0.9882352941176471\n",
      "Epoch: 51 Loss: 0.2092604637145996,  Acc: 0.8549019607843139\n",
      "Valid Epoch: 51 Loss: 0.053588077425956726,  Acc: 0.9882352941176471\n",
      "Epoch: 52 Loss: 0.1905781775712967,  Acc: 0.8797385620915035\n",
      "Valid Epoch: 52 Loss: 0.05290866643190384,  Acc: 0.9882352941176471\n",
      "Epoch: 53 Loss: 0.19011186063289642,  Acc: 0.8823529411764708\n",
      "Valid Epoch: 53 Loss: 0.05587683245539665,  Acc: 0.9882352941176471\n",
      "Epoch: 54 Loss: 0.19554133713245392,  Acc: 0.8712418300653597\n",
      "Valid Epoch: 54 Loss: 0.05550174415111542,  Acc: 0.9882352941176471\n",
      "Epoch: 55 Loss: 0.19531747698783875,  Acc: 0.8732026143790852\n",
      "Valid Epoch: 55 Loss: 0.0500333197414875,  Acc: 0.9882352941176471\n",
      "Epoch: 56 Loss: 0.19350571930408478,  Acc: 0.8725490196078433\n",
      "Valid Epoch: 56 Loss: 0.052328500896692276,  Acc: 0.9882352941176471\n",
      "Epoch: 57 Loss: 0.2149467021226883,  Acc: 0.8477124183006537\n",
      "Valid Epoch: 57 Loss: 0.049211788922548294,  Acc: 0.9882352941176471\n",
      "Epoch: 58 Loss: 0.20883236825466156,  Acc: 0.8607843137254902\n",
      "Valid Epoch: 58 Loss: 0.05270100384950638,  Acc: 0.9882352941176471\n",
      "Epoch: 59 Loss: 0.19409863650798798,  Acc: 0.8705882352941179\n",
      "Valid Epoch: 59 Loss: 0.0551714226603508,  Acc: 0.9882352941176471\n",
      "Epoch: 60 Loss: 0.2012469470500946,  Acc: 0.8575163398692812\n",
      "Valid Epoch: 60 Loss: 0.054295964539051056,  Acc: 0.9882352941176471\n",
      "Epoch: 61 Loss: 0.1848037987947464,  Acc: 0.8777777777777779\n",
      "Valid Epoch: 61 Loss: 0.05180967599153519,  Acc: 0.9882352941176471\n",
      "Epoch: 62 Loss: 0.18900126218795776,  Acc: 0.8718954248366014\n",
      "Valid Epoch: 62 Loss: 0.05138202756643295,  Acc: 0.9882352941176471\n",
      "Epoch: 63 Loss: 0.20634767413139343,  Acc: 0.8614379084967322\n",
      "Valid Epoch: 63 Loss: 0.05284494906663895,  Acc: 0.9882352941176471\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch: 64 Loss: 0.19229744374752045,  Acc: 0.8718954248366014\n",
      "Valid Epoch: 64 Loss: 0.0515938363969326,  Acc: 0.9882352941176471\n",
      "Epoch: 65 Loss: 0.20134666562080383,  Acc: 0.8640522875816995\n",
      "Valid Epoch: 65 Loss: 0.05833470821380615,  Acc: 0.9882352941176471\n",
      "Epoch: 66 Loss: 0.19279006123542786,  Acc: 0.8666666666666669\n",
      "Valid Epoch: 66 Loss: 0.051980555057525635,  Acc: 0.9882352941176471\n",
      "Epoch: 67 Loss: 0.19903632998466492,  Acc: 0.8640522875816996\n",
      "Valid Epoch: 67 Loss: 0.05808994919061661,  Acc: 0.9882352941176471\n",
      "Epoch: 68 Loss: 0.18588301539421082,  Acc: 0.8692810457516342\n",
      "Valid Epoch: 68 Loss: 0.05034660920500755,  Acc: 0.9882352941176471\n",
      "Epoch: 69 Loss: 0.18056021630764008,  Acc: 0.8954248366013073\n",
      "Valid Epoch: 69 Loss: 0.05746562033891678,  Acc: 0.9882352941176471\n",
      "Epoch: 70 Loss: 0.2059250771999359,  Acc: 0.8673202614379086\n",
      "Valid Epoch: 70 Loss: 0.05484440177679062,  Acc: 0.9882352941176471\n",
      "Epoch: 71 Loss: 0.1841597855091095,  Acc: 0.8679738562091505\n",
      "Valid Epoch: 71 Loss: 0.05518913269042969,  Acc: 0.9882352941176471\n",
      "Epoch: 72 Loss: 0.2051822990179062,  Acc: 0.8673202614379086\n",
      "Valid Epoch: 72 Loss: 0.05563456565141678,  Acc: 0.9882352941176471\n",
      "Epoch: 73 Loss: 0.2022167444229126,  Acc: 0.869934640522876\n",
      "Valid Epoch: 73 Loss: 0.054878249764442444,  Acc: 0.9882352941176471\n",
      "Epoch: 74 Loss: 0.18620269000530243,  Acc: 0.8751633986928106\n",
      "Valid Epoch: 74 Loss: 0.056113868951797485,  Acc: 0.9882352941176471\n",
      "Epoch: 75 Loss: 0.18951043486595154,  Acc: 0.8790849673202616\n",
      "Valid Epoch: 75 Loss: 0.05390142649412155,  Acc: 0.9882352941176471\n",
      "Epoch: 76 Loss: 0.19224055111408234,  Acc: 0.877777777777778\n",
      "Valid Epoch: 76 Loss: 0.05375712364912033,  Acc: 0.9882352941176471\n",
      "Epoch: 77 Loss: 0.20040854811668396,  Acc: 0.8601307189542486\n",
      "Valid Epoch: 77 Loss: 0.05363069474697113,  Acc: 0.9882352941176471\n",
      "Epoch: 78 Loss: 0.18310172855854034,  Acc: 0.8751633986928107\n",
      "Valid Epoch: 78 Loss: 0.05355657637119293,  Acc: 0.9882352941176471\n",
      "Epoch: 79 Loss: 0.1811499148607254,  Acc: 0.8816993464052291\n",
      "Valid Epoch: 79 Loss: 0.05710107833147049,  Acc: 0.9882352941176471\n",
      "Epoch: 80 Loss: 0.17812857031822205,  Acc: 0.877777777777778\n",
      "Valid Epoch: 80 Loss: 0.05604594200849533,  Acc: 0.9882352941176471\n",
      "Epoch: 81 Loss: 0.1949015110731125,  Acc: 0.8790849673202618\n",
      "Valid Epoch: 81 Loss: 0.06030936539173126,  Acc: 0.9882352941176471\n",
      "Epoch: 82 Loss: 0.19464705884456635,  Acc: 0.8594771241830067\n",
      "Valid Epoch: 82 Loss: 0.053486522287130356,  Acc: 0.9882352941176471\n",
      "Epoch: 83 Loss: 0.18365176022052765,  Acc: 0.8830065359477127\n",
      "Valid Epoch: 83 Loss: 0.05504673719406128,  Acc: 0.9882352941176471\n",
      "Epoch: 84 Loss: 0.1881629228591919,  Acc: 0.8633986928104577\n",
      "Valid Epoch: 84 Loss: 0.06341106444597244,  Acc: 0.9882352941176471\n",
      "Epoch: 85 Loss: 0.2088278830051422,  Acc: 0.8568627450980395\n",
      "Valid Epoch: 85 Loss: 0.04931853339076042,  Acc: 0.9882352941176471\n",
      "Epoch: 86 Loss: 0.18661776185035706,  Acc: 0.8738562091503271\n",
      "Valid Epoch: 86 Loss: 0.05358234420418739,  Acc: 0.9882352941176471\n",
      "Epoch: 87 Loss: 0.1811053454875946,  Acc: 0.8875816993464054\n",
      "Valid Epoch: 87 Loss: 0.0563938207924366,  Acc: 0.9882352941176471\n",
      "Epoch: 88 Loss: 0.18646769225597382,  Acc: 0.8725490196078433\n",
      "Valid Epoch: 88 Loss: 0.05808240920305252,  Acc: 0.9882352941176471\n",
      "Epoch: 89 Loss: 0.19528599083423615,  Acc: 0.869934640522876\n",
      "Valid Epoch: 89 Loss: 0.055606864392757416,  Acc: 0.9882352941176471\n",
      "Epoch: 90 Loss: 0.18460901081562042,  Acc: 0.8797385620915034\n",
      "Valid Epoch: 90 Loss: 0.05178378149867058,  Acc: 0.9882352941176471\n",
      "Epoch: 91 Loss: 0.19496625661849976,  Acc: 0.8679738562091506\n",
      "Valid Epoch: 91 Loss: 0.058335378766059875,  Acc: 0.9882352941176471\n",
      "Epoch: 92 Loss: 0.17590630054473877,  Acc: 0.8803921568627454\n",
      "Valid Epoch: 92 Loss: 0.05754801630973816,  Acc: 0.9882352941176471\n",
      "Epoch: 93 Loss: 0.1944078952074051,  Acc: 0.8633986928104578\n",
      "Valid Epoch: 93 Loss: 0.06644920259714127,  Acc: 0.9882352941176471\n",
      "Epoch: 94 Loss: 0.19480116665363312,  Acc: 0.873856209150327\n",
      "Valid Epoch: 94 Loss: 0.06214109808206558,  Acc: 0.9882352941176471\n",
      "Epoch: 95 Loss: 0.1821790635585785,  Acc: 0.8869281045751636\n",
      "Valid Epoch: 95 Loss: 0.0587744265794754,  Acc: 0.9882352941176471\n",
      "Epoch: 96 Loss: 0.18898919224739075,  Acc: 0.877777777777778\n",
      "Valid Epoch: 96 Loss: 0.06208086758852005,  Acc: 0.9882352941176471\n",
      "Epoch: 97 Loss: 0.1821313202381134,  Acc: 0.8751633986928106\n",
      "Valid Epoch: 97 Loss: 0.06597134470939636,  Acc: 0.9882352941176471\n",
      "Epoch: 98 Loss: 0.19885846972465515,  Acc: 0.8666666666666667\n",
      "Valid Epoch: 98 Loss: 0.06803300231695175,  Acc: 0.9882352941176471\n",
      "Epoch: 99 Loss: 0.18629448115825653,  Acc: 0.8732026143790852\n",
      "Valid Epoch: 99 Loss: 0.053084805607795715,  Acc: 0.9882352941176471\n",
      "Epoch: 100 Loss: 0.20517833530902863,  Acc: 0.862091503267974\n",
      "Valid Epoch: 100 Loss: 0.059021659195423126,  Acc: 0.9882352941176471\n",
      "Epoch: 101 Loss: 0.19380001723766327,  Acc: 0.858823529411765\n",
      "Valid Epoch: 101 Loss: 0.06557181477546692,  Acc: 0.9882352941176471\n",
      "Epoch: 102 Loss: 0.21050000190734863,  Acc: 0.8581699346405229\n",
      "Valid Epoch: 102 Loss: 0.05903344973921776,  Acc: 0.9882352941176471\n",
      "Epoch: 103 Loss: 0.19333526492118835,  Acc: 0.8673202614379086\n",
      "Valid Epoch: 103 Loss: 0.06310909241437912,  Acc: 0.9882352941176471\n",
      "Epoch: 104 Loss: 0.18911270797252655,  Acc: 0.8764705882352944\n",
      "Valid Epoch: 104 Loss: 0.05957019329071045,  Acc: 0.9882352941176471\n",
      "Epoch: 105 Loss: 0.18345242738723755,  Acc: 0.866013071895425\n",
      "Valid Epoch: 105 Loss: 0.06043853238224983,  Acc: 0.9882352941176471\n",
      "Epoch: 106 Loss: 0.1900652050971985,  Acc: 0.8745098039215687\n",
      "Valid Epoch: 106 Loss: 0.06278133392333984,  Acc: 0.9882352941176471\n",
      "Epoch: 107 Loss: 0.1934037208557129,  Acc: 0.8647058823529413\n",
      "Valid Epoch: 107 Loss: 0.07288146018981934,  Acc: 0.9882352941176471\n",
      "Epoch: 108 Loss: 0.19682782888412476,  Acc: 0.8712418300653597\n",
      "Valid Epoch: 108 Loss: 0.06666894257068634,  Acc: 0.9882352941176471\n",
      "Epoch: 109 Loss: 0.19148637354373932,  Acc: 0.8692810457516342\n",
      "Valid Epoch: 109 Loss: 0.060729023069143295,  Acc: 0.9882352941176471\n",
      "Epoch: 110 Loss: 0.18177135288715363,  Acc: 0.8836601307189544\n",
      "Valid Epoch: 110 Loss: 0.06911151856184006,  Acc: 0.9882352941176471\n",
      "Epoch: 111 Loss: 0.18470878899097443,  Acc: 0.8816993464052291\n",
      "Valid Epoch: 111 Loss: 0.0710163563489914,  Acc: 0.9882352941176471\n",
      "Epoch: 112 Loss: 0.16869595646858215,  Acc: 0.8705882352941179\n",
      "Valid Epoch: 112 Loss: 0.0627748891711235,  Acc: 0.9882352941176471\n",
      "Epoch: 113 Loss: 0.21333935856819153,  Acc: 0.8398692810457519\n",
      "Valid Epoch: 113 Loss: 0.06495650857686996,  Acc: 0.9882352941176471\n",
      "Epoch: 114 Loss: 0.19147735834121704,  Acc: 0.8718954248366017\n",
      "Valid Epoch: 114 Loss: 0.06184123456478119,  Acc: 0.9882352941176471\n",
      "Epoch: 115 Loss: 0.1767881214618683,  Acc: 0.8856209150326798\n",
      "Valid Epoch: 115 Loss: 0.06970514357089996,  Acc: 0.9882352941176471\n",
      "Epoch: 116 Loss: 0.18442659080028534,  Acc: 0.8732026143790851\n",
      "Valid Epoch: 116 Loss: 0.06170766055583954,  Acc: 0.9882352941176471\n",
      "Epoch: 117 Loss: 0.19670063257217407,  Acc: 0.8562091503267976\n",
      "Valid Epoch: 117 Loss: 0.06889171153306961,  Acc: 0.9882352941176471\n",
      "Epoch: 118 Loss: 0.18576183915138245,  Acc: 0.8692810457516341\n",
      "Valid Epoch: 118 Loss: 0.065097875893116,  Acc: 0.9882352941176471\n",
      "Epoch: 119 Loss: 0.17720969021320343,  Acc: 0.8823529411764707\n",
      "Valid Epoch: 119 Loss: 0.07002972811460495,  Acc: 0.9882352941176471\n",
      "Epoch: 120 Loss: 0.1843133121728897,  Acc: 0.8712418300653597\n",
      "Valid Epoch: 120 Loss: 0.06747062504291534,  Acc: 0.9882352941176471\n",
      "Epoch: 121 Loss: 0.18928983807563782,  Acc: 0.8653594771241832\n",
      "Valid Epoch: 121 Loss: 0.0672096535563469,  Acc: 0.9882352941176471\n",
      "Epoch: 122 Loss: 0.17971566319465637,  Acc: 0.8725490196078433\n",
      "Valid Epoch: 122 Loss: 0.07104229927062988,  Acc: 0.9882352941176471\n",
      "Epoch: 123 Loss: 0.18391920626163483,  Acc: 0.8679738562091505\n",
      "Valid Epoch: 123 Loss: 0.07138699293136597,  Acc: 0.9882352941176471\n",
      "Epoch: 124 Loss: 0.18943439424037933,  Acc: 0.8725490196078434\n",
      "Valid Epoch: 124 Loss: 0.06458240747451782,  Acc: 0.9882352941176471\n",
      "Epoch: 125 Loss: 0.1724759191274643,  Acc: 0.877777777777778\n",
      "Valid Epoch: 125 Loss: 0.06883808225393295,  Acc: 0.9882352941176471\n",
      "Epoch: 126 Loss: 0.18454813957214355,  Acc: 0.8751633986928106\n",
      "Valid Epoch: 126 Loss: 0.07019299268722534,  Acc: 0.9882352941176471\n",
      "Epoch: 127 Loss: 0.1875733882188797,  Acc: 0.8758169934640525\n",
      "Valid Epoch: 127 Loss: 0.06838324666023254,  Acc: 0.9882352941176471\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch: 128 Loss: 0.1787375956773758,  Acc: 0.8803921568627453\n",
      "Valid Epoch: 128 Loss: 0.06686623394489288,  Acc: 0.9882352941176471\n",
      "Epoch: 129 Loss: 0.1981903612613678,  Acc: 0.8614379084967322\n",
      "Valid Epoch: 129 Loss: 0.07312607020139694,  Acc: 0.9882352941176471\n",
      "Epoch: 130 Loss: 0.18168823421001434,  Acc: 0.866013071895425\n",
      "Valid Epoch: 130 Loss: 0.06689199805259705,  Acc: 0.9882352941176471\n",
      "Epoch: 131 Loss: 0.1904660165309906,  Acc: 0.8686274509803924\n",
      "Valid Epoch: 131 Loss: 0.0692228376865387,  Acc: 0.9882352941176471\n",
      "Epoch: 132 Loss: 0.18962571024894714,  Acc: 0.8673202614379087\n",
      "Valid Epoch: 132 Loss: 0.0766487792134285,  Acc: 0.9882352941176471\n",
      "Epoch: 133 Loss: 0.1912962645292282,  Acc: 0.8620915032679741\n",
      "Valid Epoch: 133 Loss: 0.07172192633152008,  Acc: 0.9882352941176471\n",
      "Epoch: 134 Loss: 0.18864460289478302,  Acc: 0.8758169934640524\n",
      "Valid Epoch: 134 Loss: 0.07092326879501343,  Acc: 0.9882352941176471\n",
      "Epoch: 135 Loss: 0.17464089393615723,  Acc: 0.877124183006536\n",
      "Valid Epoch: 135 Loss: 0.07086566090583801,  Acc: 0.9882352941176471\n",
      "Epoch: 136 Loss: 0.18329384922981262,  Acc: 0.8725490196078434\n",
      "Valid Epoch: 136 Loss: 0.0662459284067154,  Acc: 0.9882352941176471\n",
      "Epoch: 137 Loss: 0.17356285452842712,  Acc: 0.8882352941176472\n",
      "Valid Epoch: 137 Loss: 0.06796617805957794,  Acc: 0.9882352941176471\n",
      "Epoch: 138 Loss: 0.18375565111637115,  Acc: 0.873856209150327\n",
      "Valid Epoch: 138 Loss: 0.07359618693590164,  Acc: 0.9823529411764707\n",
      "Epoch: 139 Loss: 0.17123305797576904,  Acc: 0.8784313725490198\n",
      "Valid Epoch: 139 Loss: 0.06302851438522339,  Acc: 0.9882352941176471\n",
      "Epoch: 140 Loss: 0.1940367966890335,  Acc: 0.866013071895425\n",
      "Valid Epoch: 140 Loss: 0.05981703847646713,  Acc: 0.9882352941176471\n",
      "Epoch: 141 Loss: 0.1966303288936615,  Acc: 0.8666666666666669\n",
      "Valid Epoch: 141 Loss: 0.0753050148487091,  Acc: 0.9882352941176471\n",
      "Epoch: 142 Loss: 0.2083444893360138,  Acc: 0.862091503267974\n",
      "Valid Epoch: 142 Loss: 0.05750250071287155,  Acc: 0.9882352941176471\n",
      "Epoch: 143 Loss: 0.18110767006874084,  Acc: 0.8745098039215687\n",
      "Valid Epoch: 143 Loss: 0.07105649262666702,  Acc: 0.9882352941176471\n",
      "Epoch: 144 Loss: 0.18651556968688965,  Acc: 0.8718954248366015\n",
      "Valid Epoch: 144 Loss: 0.06848243623971939,  Acc: 0.9882352941176471\n",
      "Epoch: 145 Loss: 0.1863645762205124,  Acc: 0.8764705882352942\n",
      "Valid Epoch: 145 Loss: 0.06528803706169128,  Acc: 0.9882352941176471\n",
      "Epoch: 146 Loss: 0.19936145842075348,  Acc: 0.8627450980392158\n",
      "Valid Epoch: 146 Loss: 0.06468038260936737,  Acc: 0.9882352941176471\n",
      "Epoch: 147 Loss: 0.18586428463459015,  Acc: 0.8810457516339871\n",
      "Valid Epoch: 147 Loss: 0.06639893352985382,  Acc: 0.9882352941176471\n",
      "Epoch: 148 Loss: 0.18896208703517914,  Acc: 0.8718954248366014\n",
      "Valid Epoch: 148 Loss: 0.05859825760126114,  Acc: 0.9882352941176471\n",
      "Epoch: 149 Loss: 0.19085605442523956,  Acc: 0.8673202614379086\n",
      "Valid Epoch: 149 Loss: 0.06252440065145493,  Acc: 0.9882352941176471\n",
      "WQXPLZCIMR3C57YF4DEZ1DQL9QNVGR8DKCUVRMEUOIOJD2UFYPOO6J7LDGYEGOA5V4NEHBWXOO1TDOILUEE5OFAEEXAW_K4R9MRU\n",
      "0.85\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.85"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from train import trainA, valA, predictA\n",
    "\n",
    "for i in range(150):\n",
    "    trainA(i)\n",
    "    valA(i)\n",
    "predictA()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "celltoolbar": "Slideshow",
  "kernelspec": {
   "display_name": "Python [conda env:torch]",
   "language": "python",
   "name": "conda-env-torch-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
